Skip to content
Snippets Groups Projects
Commit fff7df21 authored by Jure's avatar Jure
Browse files

fix: always redirect if currentUser can't be determined

parent 396ee878
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ const updateStuff = data => {
const RolesUpdater = ({ children, history, match }) => {
// This updates the current roles app-wide using Apollo's makeVar
const { error } = useQuery(GET_CURRENT_USER, {
const { data, error, loading } = useQuery(GET_CURRENT_USER, {
pollInterval: 5000,
notifyOnNetworkStatusChange: true,
fetchPolicy: 'network-only',
......@@ -20,7 +20,7 @@ const RolesUpdater = ({ children, history, match }) => {
onCompleted: useCallback(data => updateStuff(data), []),
})
if (error && !error.networkError) {
if ((error && !error.networkError) || (!loading && !data?.currentUser)) {
return <Redirect to="/login" />
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment