feat: discord link success/fail toasts

This commit is contained in:
limes
2026-08-17 20:37:59 +02:00
parent 571158cbb2
commit cf7d7fe6c1
3 changed files with 27 additions and 7 deletions

View File

@@ -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

View File

@@ -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');
});

View File

@@ -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({
/>
<h2>{{ $t("account.settings.settingCards.beta") }}</h2>
</label>
<input
<input
v-if="profile.accessLevel === 3"
id="dev"
v-model="selectedServerEnv"