diff --git a/src/pages/Register.vue b/src/pages/Register.vue index cc48de6..c7176bf 100644 --- a/src/pages/Register.vue +++ b/src/pages/Register.vue @@ -3,12 +3,12 @@ import { onMounted, ref } from 'vue'; import CapsuleIcon from '@/components/icons/CapsuleIcon.vue'; import RegisterMethods from '@/components/register/RegisterMethods.vue'; import SignUp from '@/components/register/SignUp.vue'; -import useLogin, { Status } from '@/plugins/loginMethods'; +import useLogin, { ITorusResponse, Status } from '@/plugins/loginMethods'; import router from '@/router'; -import { toastError, toastWarning } from '@/plugins/toast'; +import { toastError } from '@/plugins/toast'; const isLoading = ref(false); -const step = ref<`registerMethods` | `signUp`>(`registerMethods`); +const userInfo = ref(null); const login = useLogin(); onMounted(async () => { @@ -18,12 +18,8 @@ onMounted(async () => { if (userData) { const res = await login.verify(userData.privateKey); switch (res) { - case Status.NO_ACCOUNT: - // If no username is found then register... - toastWarning(`looks like you don't have an account`); - return; case Status.BLOCKED: - // If account is blocked then send to register page... + // If account is blocked then send to home page... toastError(`Your account has been deactivated or banned`); router.push(`/home`); return; @@ -31,11 +27,16 @@ onMounted(async () => { router.push(`/home`); location.reload(); return; + case Status.NO_ACCOUNT: + userInfo.value = userData; } } isLoading.value = false; - } catch (err) { - console.log(err); + } catch (err: unknown) { + console.error(err); + if (err instanceof Error) { + toastError(err.message); + } } }); @@ -58,8 +59,8 @@ onMounted(async () => {
- - + +