1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-29 09:49:38 +02:00

Refactor Docker Compose configuration and enhance email management in settings

This commit is contained in:
Sean Morley 2024-12-07 16:15:41 -05:00
parent 64105808b5
commit 6a00a2ed55
8 changed files with 172 additions and 62 deletions

View file

@ -10,27 +10,3 @@ export const fetchCSRFToken = async () => {
return null;
}
};
export const tryRefreshToken = async (refreshToken: string) => {
const csrfToken = await fetchCSRFToken();
const refreshFetch = await fetch(`${serverEndpoint}/auth/token/refresh/`, {
method: 'POST',
headers: {
'X-CSRFToken': csrfToken,
'Content-Type': 'application/json' // Corrected header name
},
body: JSON.stringify({ refresh: refreshToken })
});
if (refreshFetch.ok) {
const refresh = await refreshFetch.json();
const token = `auth=${refresh.access}`;
return token;
// event.cookies.set('auth', `auth=${refresh.access}`, {
// httpOnly: true,
// sameSite: 'lax',
// expires: new Date(Date.now() + 60 * 60 * 1000), // 60 minutes
// path: '/'
// });
}
};