Closed weisisheng closed 1 year ago
Mixing a bit examples from react-admin and from demo app, I managed to make it work like this:
...
import { buildAuthProvider } from "react-admin-amplify";
import dataProvider from "./dataProvider";
Amplify.configure({
...
},
});
const authProvider = buildAuthProvider();
authProvider.getIdentity = async () => {
const userInfo = await Auth.currentUserInfo();
return Promise.resolve({
id: userInfo.username,
fullName: userInfo.attributes.name,
});
};
function App() {
return (
<Admin
authProvider={authProvider}
dataProvider={dataProvider}
...
AuthProvider is an awesome wrapper. Yet, I am unsure how to get the details of the current logged -in user for further manipulation (triggering in-app messages, emails, etc)?
I noted the graphql query for 'demo' in the '17 patterns example', but that already has a 'demo user' to reference.
Would appreciate any advice.