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 16911f1..ac4466c 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 {};
});
From 60cc3e958cee1ecb12ea93135c66f0c66cb07c43 Mon Sep 17 00:00:00 2001
From: grngxd <36968271+grngxd@users.noreply.github.com>
Date: Thu, 31 Jul 2025 10:57:45 +0100
Subject: [PATCH 2/2] logging out
---
src/components/dashboard/Settings.tsx | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
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
+
);
});