You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by so...@apache.org on 2023/05/09 09:41:14 UTC

[incubator-seatunnel-web] branch add_canvas_job_define updated: [Feat][UI] Add 401 support.

This is an automated email from the ASF dual-hosted git repository.

songjian pushed a commit to branch add_canvas_job_define
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel-web.git


The following commit(s) were added to refs/heads/add_canvas_job_define by this push:
     new 2ab3b956 [Feat][UI] Add 401 support.
2ab3b956 is described below

commit 2ab3b956c0954a08c1c416a00f4af86d616525e0
Author: songjianet <17...@qq.com>
AuthorDate: Tue May 9 17:41:03 2023 +0800

    [Feat][UI] Add 401 support.
---
 seatunnel-ui/src/service/service.ts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/seatunnel-ui/src/service/service.ts b/seatunnel-ui/src/service/service.ts
index d78f4f10..8897f28d 100644
--- a/seatunnel-ui/src/service/service.ts
+++ b/seatunnel-ui/src/service/service.ts
@@ -22,6 +22,7 @@ import axios, {
   InternalAxiosRequestConfig
 } from 'axios'
 import utils from '@/utils'
+import router from '@/router'
 import { useUserStore } from '@/store/user'
 import { useSettingStore } from '@/store/setting'
 import type { UserDetail } from '@/service/user/types'
@@ -47,6 +48,11 @@ const baseRequestConfig: AxiosRequestConfig = {
 const service = axios.create(baseRequestConfig)
 
 const err = (err: AxiosError): Promise<AxiosError> => {
+  const userStore = useUserStore()
+  if (err.response?.status === 401) {
+    userStore.setUserInfo({})
+    router.push({ path: '/login' })
+  }
   return Promise.reject(err)
 }