InvalidateResources on Logout or Login

I have resources that are available unauthed, but are personalized when authed
The personalization is done with the userContext that is from the auth header, so the request doesnt actually change
I'm wanting to invalidate these resources on login/logout

I tried to make a:
export const useAuthProvider = (): AuthProvider => {
  const { invalidate } = useInvalidate();

  return {
     ...
     logout() {
        ...
        invalidate({resources: ["all"]});
     },
      
     login() {
        ...
        invalidate({resources: ["all"]});
     }
  }
}

function App() {
    const authProvider = useAuthProvider();
    return (<Refine
       authProvider={authProvider}
       ...
    >);
}


But this did not work because the useInvalidate must be within the QueryClientProvider that is provided by <Refine>

Also it would be great if I could somehow tag my queries as
shouldBeInvalidatedOnAuthChange
Was this page helpful?