We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1df27eb commit b065db4Copy full SHA for b065db4
react-static-web-apps-auth/src/ClientPrincipalContext.tsx
@@ -40,9 +40,12 @@ const ClientPrincipalContextProvider = ({
40
const [swaCookie, setSwaCookie] = useState<string | null>(null);
41
42
useEffect(() => {
43
+ const abortController = new AbortController();
44
const run = async () => {
45
try {
- const res = await fetch("/.auth/me");
46
+ const res = await fetch("/.auth/me", {
47
+ signal: abortController.signal,
48
+ });
49
const json: {
50
clientPrincipal: ClientPrincipal | null;
51
} = await res.json();
@@ -66,6 +69,8 @@ const ClientPrincipalContextProvider = ({
66
69
};
67
70
68
71
run();
72
+
73
+ return () => abortController.abort();
74
}, []);
75
76
return (
0 commit comments