From cf7d7fe6c1a6a2bfa5a6dfcf8691bb53e6c4bf28 Mon Sep 17 00:00:00 2001 From: limes Date: Mon, 17 Aug 2026 20:37:59 +0200 Subject: [PATCH] feat: discord link success/fail toasts --- README.md | 8 +++---- server/routes/account/connect/discord.get.ts | 4 ++-- src/pages/account/index.vue | 22 +++++++++++++++++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e6031a7..5544228 100644 --- a/README.md +++ b/README.md @@ -131,10 +131,10 @@ Testing findings: - [X] rss feed wrong content type -- [?] progress page has no mobile layout (jvs you suck) -- [?] progress seems to sometimes not load for jvs? +- [X] progress page has no mobile layout (jvs you suck) +- [X] progress seems to sometimes not load for jvs? -idk jvs, seems to work on my machine! +idk jvs, seems to work on my machine... and yours too now??? - [ ] docs errors page, ironically, gives an error - [X] docs headings are very purple @@ -150,7 +150,7 @@ idk jvs, seems to work on my machine! - [X] account shows beta switch even if it's disabled - [X] if user has beta access they should be able to change back to prod - [X] add dev server env button -- [ ] discord link/remove success toast +- [X] discord link success/fail toast - [ ] forgot password shows success toast even w no captcha (doesn't actually submit) - [ ] signup birthdate editor diff --git a/server/routes/account/connect/discord.get.ts b/server/routes/account/connect/discord.get.ts index 75823cb..528bbac 100644 --- a/server/routes/account/connect/discord.get.ts +++ b/server/routes/account/connect/discord.get.ts @@ -48,7 +48,7 @@ export default defineEventHandler(async (event) => { } }); if (!authInfo.user) { - return sendRedirect(event, '/'); // No identify scope + return sendRedirect(event, '/account?discord_link_success=false'); // No identify scope } const discordId = authInfo.user.id; @@ -75,5 +75,5 @@ export default defineEventHandler(async (event) => { } } - return sendRedirect(event, '/account'); + return sendRedirect(event, '/account?discord_link_success=true'); }); diff --git a/src/pages/account/index.vue b/src/pages/account/index.vue index d40d97c..4e0bc0f 100644 --- a/src/pages/account/index.vue +++ b/src/pages/account/index.vue @@ -31,6 +31,26 @@ watchImmediate(upgradeSuccessQuery, (val) => { useRouter().replace({ query: {} }); }); +const discordLinkQuery = computed(() => route.query.discord_link_success); +watchImmediate(discordLinkQuery, (val) => { + if (!val) { + return; + } + if (val === 'true') { + toasts.publish({ + type: 'success', + text: 'Discord account linked successfully' + }); + } + if (val === 'false') { + toasts.publish({ + type: 'error', + text: 'Failed to link Discord account' + }); + } + useRouter().replace({ query: {} }); +}); + const { data: profile, refresh } = await useApiFetch('/api/auth/me'); const { data: connections, refresh: refreshConnections } = await useApiFetch('/api/auth/me-connections'); @@ -334,7 +354,7 @@ useHead({ />

{{ $t("account.settings.settingCards.beta") }}

-