Add back pickers on all pages, fix command menu (#2662)

* Add back pickers on all pages, fix command menu

* Fix lint
This commit is contained in:
Charles Bochet
2023-11-22 22:32:25 +01:00
committed by GitHub
parent 41c0cebf48
commit ec3cfe6fdb
42 changed files with 425 additions and 300 deletions

View File

@ -5,6 +5,9 @@ import { useApolloFactory } from '@/apollo/hooks/useApolloFactory';
export const ApolloProvider = ({ children }: React.PropsWithChildren) => {
const apolloClient = useApolloFactory();
// This will attach the right apollo client to Apollo Dev Tools
window.__APOLLO_CLIENT__ = apolloClient;
return (
<ApolloProviderBase client={apolloClient}>{children}</ApolloProviderBase>
);

View File

@ -83,6 +83,18 @@ export class ApolloFactory<TCacheShape> implements ApolloManager<TCacheShape> {
onErrorCb?.(graphQLErrors);
for (const graphQLError of graphQLErrors) {
if (graphQLError.message === 'Unauthorized') {
return fromPromise(
renewToken(uri, this.tokenPair)
.then((tokens) => {
onTokenPairChange?.(tokens);
})
.catch(() => {
onUnauthenticatedError?.();
}),
).flatMap(() => forward(operation));
}
switch (graphQLError?.extensions?.code) {
case 'UNAUTHENTICATED': {
return fromPromise(