aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/logout/index.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-07-30 09:47:08 -0700
committerAdam Soltys <[email protected]>2022-07-30 09:47:08 -0700
commite969501cbaeafaa5b81c20b73455ab19cde2eb0e (patch)
tree025303917f20900043c8abae60740180b5aa1834 /src/routes/logout/index.js
parent54962d8d54ea899e0010114939019ba6a18c5515 (diff)
downloadcoinos-ui-e969501cbaeafaa5b81c20b73455ab19cde2eb0e.tar.gz
coinos-ui-e969501cbaeafaa5b81c20b73455ab19cde2eb0e.zip
logout function
Diffstat (limited to 'src/routes/logout/index.js')
-rw-r--r--src/routes/logout/index.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/routes/logout/index.js b/src/routes/logout/index.js
new file mode 100644
index 00000000..80e65f8b
--- /dev/null
+++ b/src/routes/logout/index.js
@@ -0,0 +1,26 @@
+import cookie from "cookie";
+
+const opts = {
+ httpOnly: true,
+ sameSite: "lax",
+ path: "/",
+};
+
+export async function GET({ request: { headers } }) {
+ return {
+ status: 302,
+ headers: {
+ location: "/logout/done",
+ "set-cookie": [
+ cookie.serialize("token", "", {
+ ...opts,
+ expires: new Date(0),
+ }),
+ cookie.serialize("refresh_token", "", {
+ ...opts,
+ expires: new Date(0),
+ }),
+ ],
+ },
+ };
+}