-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added a frontend page to activate and redirect
- Loading branch information
Showing
5 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<template> | ||
<div class="flex flex-col items-center justify-center h-[80svh] gap-4"> | ||
<p class="font-semibold text-4xl">{{ activationStatus }}</p> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref, onMounted } from 'vue'; | ||
import { useRouter } from "vue-router"; | ||
const config = useRuntimeConfig(); | ||
const activationStatus = ref(''); | ||
const router = useRouter(); | ||
async function activateUser() { | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const uuid = urlParams.get('uuid'); | ||
const token = urlParams.get('token'); | ||
let status = ''; | ||
try { | ||
const response = await $fetch(`${config.public.API_BASE_URL}/api/accounts/activate/${uuid}/${token}`); | ||
status = await response.text(); | ||
if (response.type === '200') { | ||
router.push({ path: '/signin', query: { msg: 'account activated' } }); | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
status = 'Activation failed'; | ||
} | ||
return status; | ||
} | ||
onMounted(async () => { | ||
const status = await activateUser(); | ||
activationStatus.value = status +' !!'; | ||
}); | ||
</script> |