Skip to content

Commit

Permalink
Try some things with old auth cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Jun 17, 2024
1 parent bdd25e6 commit adc99f0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions website/src/router/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import TwitchAuthScopeSelector from "@/components/website/TwitchAuthScopeSelecto
import BracketCreator from "@/views/BracketCreator.vue";
import NotFoundPage from "@/views/NotFoundPage";
import Learn from "@/views/Learn.vue";
import Cookies from "universal-cookie";

export default [
{
Expand Down Expand Up @@ -197,6 +198,18 @@ export default [
}),
children: BroadcastRoutes
},

{
path: "/reset",
redirect: to => {
console.log("setting cookies to empty");

(new Cookies()).remove("auth", { path: "/" });
(new Cookies()).remove("auth", { path: "/", domain: "." + window.location.hostname });

return { path: "/" };
},
},
{ path: "/:pathMatch(.*)*", component: NotFoundPage }
// {
// path: "/redirect",
Expand Down
8 changes: 8 additions & 0 deletions website/src/stores/authStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ const cookies = new Cookies(null, {
domain: window.location.hostname.endsWith("slmn.gg") ? ".slmn.gg" : window.location.hostname
});

function removeOldCookies() {
(new Cookies()).remove("auth", { path: "/", domain: "dev.slmn.gg" });
}

if (window.location.hostname === "dev.slmn.gg") {
removeOldCookies();
}

export const useAuthStore = defineStore("auth", () => {
const token = ref<string | null>(null);
const authNext = ref<string | null>(null);
Expand Down

0 comments on commit adc99f0

Please sign in to comment.