From 7cd53e0e9d34c1e162b360a10385485dafce90b9 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 13 Jul 2024 18:03:15 +0530 Subject: redirecting to login page on refresh token expire --- src/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.ts b/src/main.ts index 56ab8a3..f4c9923 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,7 +6,6 @@ import axios from 'axios' import 'vue-toast-notification/dist/theme-sugar.css' import './assets/main.scss' - axios.defaults.baseURL = '/api' axios.defaults.headers.post['Content-Type'] = 'application/json' @@ -48,6 +47,10 @@ axios.interceptors.response.use( } } + if (originalConfig.url === "/auth/refresh" && err.response.status === 401) { + router.push(`/login?redirect=${router.currentRoute.value.fullPath}&reason=session_expired`) + } + return Promise.reject(err) } ) -- cgit v1.2.3