Merge branch 'develop' into 'main'
develop See merge request witapp/aura-webapp!599
This commit is contained in:
commit
170720d316
@ -3,13 +3,14 @@ import { useAuth } from "@/auth/useAuth";
|
|||||||
import { actions } from "@/store";
|
import { actions } from "@/store";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { useSearchParams } from "react-router-dom";
|
import { useLocation, useSearchParams } from "react-router-dom";
|
||||||
|
|
||||||
interface InitializationProviderProps {
|
interface InitializationProviderProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function InitializationProvider({ children }: InitializationProviderProps) {
|
export function InitializationProvider({ children }: InitializationProviderProps) {
|
||||||
|
const location = useLocation();
|
||||||
const [isInitialized, setIsInitialized] = useState(false);
|
const [isInitialized, setIsInitialized] = useState(false);
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const jwtToken = searchParams.get("token");
|
const jwtToken = searchParams.get("token");
|
||||||
@ -64,7 +65,7 @@ export function InitializationProvider({ children }: InitializationProviderProps
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [dispatch, api, token]);
|
}, [dispatch, api, token, location.pathname]);
|
||||||
|
|
||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user