diff --git a/src/components/dashboard/Settings.tsx b/src/components/dashboard/Settings.tsx index 104d316..818322a 100644 --- a/src/components/dashboard/Settings.tsx +++ b/src/components/dashboard/Settings.tsx @@ -3,7 +3,8 @@ // import { isSettingsOpen, userInfo } from "~/lib/stores"; // import { StereoUser } from "~/lib/types"; -import { component$, useComputed$, useSignal, useTask$ } from "@builder.io/qwik"; +import { $, component$, useComputed$, useSignal, useTask$ } from "@builder.io/qwik"; +import ky from "ky"; import { useNanostore$ } from "~/hooks/nanostores"; import { isSettingsOpen } from "~/lib/stores"; @@ -34,9 +35,22 @@ const PrivacyAndSecurity = component$(() => { }); const DangerZone = component$(() => { + const handleLogout = $(() => { + ky.get("/api/auth/logout", { credentials: "include" }) + .then(() => { + window.location.href = "/"; + }); + }); + return (

delete your account and data here

+
); }); diff --git a/src/components/landing/CallToAction.tsx b/src/components/landing/CallToAction.tsx index 1b4fc31..cbdb4f1 100644 --- a/src/components/landing/CallToAction.tsx +++ b/src/components/landing/CallToAction.tsx @@ -1,5 +1,4 @@ import { component$ } from "@builder.io/qwik"; -import { OAUTH_LINK } from "~/lib/constants"; export default component$(() => (
( join over 100k other people hosting their files with stereo!

get started diff --git a/src/components/landing/Hero.tsx b/src/components/landing/Hero.tsx index 298c35b..c7b30b5 100644 --- a/src/components/landing/Hero.tsx +++ b/src/components/landing/Hero.tsx @@ -1,6 +1,5 @@ import { component$, useSignal } from "@builder.io/qwik"; import { useRelativeMouse } from "~/hooks/mouse"; -import { OAUTH_LINK } from "~/lib/constants"; import GradientBorder from "../misc/GradientBorder"; export default component$(() => { @@ -22,7 +21,7 @@ export default component$(() => {

get started diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 60a2ab9..c55705b 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1 +1 @@ -export const OAUTH_LINK = "https://discord.com/oauth2/authorize?client_id=1368939221678817382&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fapi%2Fauth%2Fcallback&scope=identify+email" \ No newline at end of file +//export const OAUTH_LINK = "https://discord.com/oauth2/authorize?client_id=1368939221678817382&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fapi%2Fauth%2Fcallback&scope=identify+email" \ No newline at end of file diff --git a/src/routes/dashboard/index.tsx b/src/routes/dashboard/index.tsx index bc81ebd..22d044e 100644 --- a/src/routes/dashboard/index.tsx +++ b/src/routes/dashboard/index.tsx @@ -6,14 +6,13 @@ import Titlebar from "~/components/dashboard/Titlebar"; // import Dropzone from "~/components/Dropzone"; import { useNanostore$ } from "~/hooks/nanostores"; import { api } from "~/lib/api"; -import { OAUTH_LINK } from "~/lib/constants"; import { areFilesLoaded, dashboardFiles } from "~/lib/stores"; import { StereoFile } from "~/lib/types"; export const useAuthCheck = routeLoader$(({ cookie, redirect: r }) => { const jwt = cookie.get("jwt"); if (jwt) return {}; - throw r(302, OAUTH_LINK); + throw r(302, "/api/auth/login"); }); export default component$(() => { diff --git a/src/routes/index.tsx b/src/routes/index.tsx index b1dc77d..4fca559 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -13,7 +13,7 @@ export const useAuthCheck = routeLoader$(({ cookie, redirect: r, query }) => { const set = Boolean(query.get("jwt_set")); if (jwt && set) { - throw r(302, "/dashboard"); + throw r(302, "/api/auth/login"); } return {}; });