diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-12-07 16:43:22 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-12-07 16:43:22 +0530 |
commit | b962a21b15e3d80d4d2132df76ca31bc41eb2fc9 (patch) | |
tree | ce40c6184f4c1e08d6a2712a1e45c89794ef6268 /src/views/LogIn.vue | |
parent | 33ae84aea901c6737eb10b4e283d5de09c769512 (diff) |
redirecting after login0.4.1
Diffstat (limited to 'src/views/LogIn.vue')
-rw-r--r-- | src/views/LogIn.vue | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/views/LogIn.vue b/src/views/LogIn.vue index 1b5f6c9..415c562 100644 --- a/src/views/LogIn.vue +++ b/src/views/LogIn.vue @@ -1,6 +1,6 @@ <script setup lang="js"> import { ref, toRaw } from 'vue' -import { RouterLink, useRouter } from 'vue-router' +import { RouterLink, useRoute, useRouter } from 'vue-router' import axios from 'axios' import { useToast } from 'vue-toast-notification' @@ -8,6 +8,7 @@ const toast = useToast({ position: 'top-right' }) +const route = useRoute() const router = useRouter() const storedEmail = sessionStorage.getItem('email') @@ -30,7 +31,7 @@ const login = async (e) => { localStorage.setItem('authToken', res.data.auth_token) localStorage.setItem('refToken', res.data.refresh_token) toast.default(`Welcome, ${res.data.data.Username}`) - router.push({ path: '/' }) + router.push({ path: route.query.redirect ? route.query.redirect : '/' }) } catch (err) { const statusCode = err.request.status |