diff options
Diffstat (limited to 'src/views')
-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 |