UNPKG

@lucia-auth/nextjs

Version:
19 lines (18 loc) 495 B
export const getUser = async () => { const response = await fetch("/api/auth/user"); if (!response.ok) return null; const { user } = (await response.json()); return user; }; export const signOut = async () => { const response = await fetch("/api/auth/logout", { method: "POST" }); if (!response.ok) throw new Error("unknown error"); const { error } = (await response.json()); if (!error) return; throw new Error(error); };