We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16a7e57 commit cb6ad18Copy full SHA for cb6ad18
site/api.ts
@@ -14,6 +14,18 @@ export const login = async (email: string, password: string): Promise<LoginRespo
14
}),
15
})
16
17
+ return await readOrThrowResponse(response)
18
+}
19
+
20
+export const logout = async (): Promise<void> => {
21
+ const response = await fetch("/api/v2/logout", {
22
+ method: "POST",
23
+ })
24
25
26
27
28
+const readOrThrowResponse = async (response: Response): Promise<any> => {
29
const body = await response.json()
30
if (!response.ok) {
31
throw new Error(body.message)
0 commit comments