diff --git a/frontend/src/lib/@api/admin.ts b/frontend/src/lib/@api/admin.ts index dd54940..e98595f 100644 --- a/frontend/src/lib/@api/admin.ts +++ b/frontend/src/lib/@api/admin.ts @@ -38,6 +38,24 @@ export const resetCandidatePassword = async (id: number): Promise { + try { + if (fetchSsr) { + const res = await fetchSsr(API_URL + '/admin/logout', { + method: 'POST', + credentials: 'include' + }); + return await res.text(); + } + const res = await axios.post(API_URL + '/admin/logout', { withCredentials: true }); + return res.data; + } catch (e: any) { + throw errorHandler(e, 'Logout failed'); + } +}; + // SSR compatible // List all candidates /admin/list/candidates export const apiListCandidates = async (fetchSsr?: Fetch): Promise<[CandidatePreview]> => {