Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin UI branding hook #2474

Merged
merged 4 commits into from
Apr 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Admin UI: enable use of custom UI hooks in the public context
  • Loading branch information
Vultraz committed Mar 4, 2020
commit 0493763d32e9703bcd22d1af1327205644fc25f6
39 changes: 21 additions & 18 deletions packages/app-admin-ui/client/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ApolloClient from './apolloClient';

import ConnectivityListener from './components/ConnectivityListener';
import { AdminMetaProvider, useAdminMeta } from './providers/AdminMeta';
import { HooksProvider } from './providers/Hooks';

import InvalidRoutePage from './pages/InvalidRoute';
import SignoutPage from './pages/Signout';
Expand All @@ -24,28 +25,30 @@ import SigninPage from './pages/Signin';
*/

const Keystone = () => {
const { authStrategy, apiPath, signoutPath } = useAdminMeta();
const { authStrategy, apiPath, signoutPath, hooks } = useAdminMeta();

const apolloClient = useMemo(() => new ApolloClient({ uri: apiPath }), [apiPath]);

return (
<ApolloProvider client={apolloClient}>
<ToastProvider>
<ConnectivityListener />
<Global styles={globalStyles} />

{authStrategy ? (
<BrowserRouter>
<Switch>
<Route exact path={signoutPath} render={() => <SignoutPage />} />
<Route render={() => <SigninPage />} />
</Switch>
</BrowserRouter>
) : (
<InvalidRoutePage />
)}
</ToastProvider>
</ApolloProvider>
<HooksProvider hooks={hooks}>
<ApolloProvider client={apolloClient}>
<ToastProvider>
<ConnectivityListener />
<Global styles={globalStyles} />

{authStrategy ? (
<BrowserRouter>
<Switch>
<Route exact path={signoutPath} render={() => <SignoutPage />} />
<Route render={() => <SigninPage />} />
</Switch>
</BrowserRouter>
) : (
<InvalidRoutePage />
)}
</ToastProvider>
</ApolloProvider>
</HooksProvider>
);
};

Expand Down