Skip to content

Commit 52699e7

Browse files
committed
run prettier
1 parent 232ea70 commit 52699e7

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

hooks/useFetchInterceptor.tsx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
import { useEffect } from 'react';
2+
23
import { signOut } from 'next-auth/react';
34

45
const useFetchInterceptor = () => {
5-
useEffect(() => {
6-
const handleResponse = (response: Response) => {
7-
if (response.status === 401) {
8-
const currentUrl = window.location.href;
9-
signOut({ callbackUrl: `/api/auth/signin?error=SessionRequired&callbackUrl=${encodeURIComponent(currentUrl)}` });
10-
}
11-
return response;
12-
};
6+
useEffect(() => {
7+
const handleResponse = (response: Response) => {
8+
if (response.status === 401) {
9+
const currentUrl = window.location.href;
10+
signOut({
11+
callbackUrl: `/api/auth/signin?error=SessionRequired&callbackUrl=${encodeURIComponent(currentUrl)}`,
12+
});
13+
}
14+
return response;
15+
};
1316

14-
const originalFetch = global.fetch.bind(global);
17+
const originalFetch = global.fetch.bind(global);
1518

16-
global.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
17-
const response = await originalFetch(input, init);
18-
return handleResponse(response);
19-
};
19+
global.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
20+
const response = await originalFetch(input, init);
21+
return handleResponse(response);
22+
};
2023

21-
return () => {
22-
global.fetch = originalFetch;
23-
};
24-
}, []);
24+
return () => {
25+
global.fetch = originalFetch;
26+
};
27+
}, []);
2528
};
2629

2730
export default useFetchInterceptor;

pages/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import {
3030

3131
import { getAppLogo } from '@/components/AppLogo/AppLogo';
3232
import { getInitialOrchestratorConfig } from '@/configuration';
33+
import useFetchInterceptor from '@/hooks/useFetchInterceptor';
3334
import { TranslationsProvider } from '@/translations/translationsProvider';
3435

3536
import '../font/inter.css';
36-
import useFetchInterceptor from "@/hooks/useFetchInterceptor";
3737

3838
type AppOwnProps = { orchestratorConfig: OrchestratorConfig };
3939

0 commit comments

Comments
 (0)