MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / signOut

Function signOut

packages/auth-client/src/client/index.tsx:330–357  ·  view source on GitHub ↗
(
  options?: SignOutParams<R>
)

Source from the content-addressed store, hash-verified

328 *
329 */
330export async function signOut<R extends boolean = true>(
331 options?: SignOutParams<R>
332): Promise<R extends true ? undefined : SignOutResponse> {
333 const { callbackUrl = window.location.href } = options || {};
334 const baseUrl = __LINEN_AUTH.basePath;
335 const fetchOptions = {
336 method: 'post',
337 headers: {
338 'Content-Type': 'application/x-www-form-urlencoded',
339 },
340 // @ts-expect-error
341 body: new URLSearchParams({
342 csrfToken: await getCsrfToken(),
343 callbackUrl,
344 json: true,
345 }),
346 };
347 const res = await fetch(`${baseUrl}/signout`, fetchOptions);
348 const data = await res.json();
349 cleanUpStorage();
350
351 broadcast.post({ event: 'session', data: { trigger: 'signout' } });
352
353 window.location.href = callbackUrl;
354 await __LINEN_AUTH._getSession({ event: 'storage' });
355
356 return data;
357}
358
359/**
360 * Provider to wrap the app in to make session data available globally.

Callers 3

ProfileFunction · 0.90
MobileMenuFunction · 0.85
onClickFunction · 0.85

Calls 3

cleanUpStorageFunction · 0.90
getCsrfTokenFunction · 0.85
postMethod · 0.45

Tested by

no test coverage detected