aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2024-07-13 18:03:15 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2024-07-13 18:03:15 +0530
commit7cd53e0e9d34c1e162b360a10385485dafce90b9 (patch)
treeae2e88b97460bd673943193286e94779750add73 /src
parenta43046dc5d0d022048c85e814da5681c3ca3a9b9 (diff)
redirecting to login page on refresh token expire
Diffstat (limited to 'src')
-rw-r--r--src/main.ts5
1 files changed, 4 insertions, 1 deletions
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)
}
)