fix: 🎨 migrate from / to /confirm for email confirmation

This commit is contained in:
Raymond
2025-05-31 16:32:42 -04:00
committed by Azalea
parent 9c91d730b4
commit 2563a31d15
3 changed files with 19 additions and 15 deletions

View File

@@ -79,6 +79,7 @@
<Router {url}>
<Route path="/" component={Welcome} />
<Route path="/confirm" component={Welcome} /> <!-- For email confirmation only, backwards compatibility with AquaNet2 in the future -->
<Route path="/home" component={Home} />
<Route path="/ranking" component={Ranking} />
<Route path="/ranking/:game" component={Ranking} />

View File

@@ -24,23 +24,26 @@
if (USER.isLoggedIn()) {
window.location.href = "/home"
}
if (location.pathname !== '/') {
location.href = `/${params.get('confirm-email') ? `?confirm-email=${params.get('confirm-email')}` : ""}`
} else
if (params.get('confirm-email')) {
if (params.get('confirm-email')) {
state = 'verify'
verifyMsg = t("welcome.verifying")
submitting = true
state = 'verify'
verifyMsg = t("welcome.verifying")
submitting = true
// Send request to server
USER.confirmEmail(params.get('confirm-email')!)
.then(() => {
verifyMsg = t('welcome.verified')
submitting = false
// Send request to server
USER.confirmEmail(params.get('confirm-email')!)
.then(() => {
verifyMsg = t('welcome.verified')
submitting = false
// Clear the query param
window.history.replaceState({}, document.title, window.location.pathname)
})
.catch(e => verifyMsg = t('welcome.verification-failed', { message: e.message }))
}
// Clear the query param
window.history.replaceState({}, document.title, window.location.pathname)
})
.catch(e => verifyMsg = t('welcome.verification-failed', { message: e.message }))
}
async function submit(): Promise<any> {
submitting = true