Logout
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
---
|
||||
// TODO
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME, API_REFRESH_TOKEN_COOKIE_NAME, API_UID_COOKIE_NAME } from "#lib/constants";
|
||||
|
||||
import Layout from "#layouts/Layout.astro";
|
||||
---
|
||||
|
||||
<script>
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME, API_REFRESH_TOKEN_COOKIE_NAME, API_UID_COOKIE_NAME } from "#lib/constants.js"
|
||||
import Cookies from "js-cookie"
|
||||
Astro.cookies.delete(API_ACCESS_TOKEN_COOKIE_NAME, {
|
||||
domain: `.${Astro.url.hostname}`,
|
||||
path: "/",
|
||||
});
|
||||
Astro.cookies.delete(API_REFRESH_TOKEN_COOKIE_NAME, {
|
||||
domain: `.${Astro.url.hostname}`,
|
||||
path: "/",
|
||||
});
|
||||
Astro.cookies.delete(API_UID_COOKIE_NAME, {
|
||||
domain: `.${Astro.url.hostname}`,
|
||||
path: "/",
|
||||
});
|
||||
|
||||
Cookies.remove(API_ACCESS_TOKEN_COOKIE_NAME)
|
||||
Cookies.remove(API_REFRESH_TOKEN_COOKIE_NAME)
|
||||
Cookies.remove(API_UID_COOKIE_NAME)
|
||||
return Astro.redirect("/");
|
||||
|
||||
window.location.href = "/"
|
||||
</script>
|
||||
|
||||
<Layout title="Logout">
|
||||
|
||||
</Layout>
|
||||
---
|
||||
Reference in New Issue
Block a user