From 75cf241f76913a8e1a7e81962225aa73b2314008 Mon Sep 17 00:00:00 2001 From: hugang <18768366022@163.com> Date: Sat, 14 Sep 2024 11:11:02 +0800 Subject: [PATCH] fix the router redirect error --- oauth2_web/deploy/authhub.nginx.conf | 4 ++-- oauth2_web/src/api/request.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/oauth2_web/deploy/authhub.nginx.conf b/oauth2_web/deploy/authhub.nginx.conf index f9720c3..a38eb1f 100644 --- a/oauth2_web/deploy/authhub.nginx.conf +++ b/oauth2_web/deploy/authhub.nginx.conf @@ -14,8 +14,8 @@ server { root /opt/authhub/web/dist; expires 30d; } - location /authhub { - alias /opt/authhub/web/dist + location / { + root /opt/authhub/web/dist; try_files $uri $uri/ /index.html; if (!-e $request_filename){ rewrite ^(.*)$ /index.html last; diff --git a/oauth2_web/src/api/request.ts b/oauth2_web/src/api/request.ts index 526323f..e50e308 100644 --- a/oauth2_web/src/api/request.ts +++ b/oauth2_web/src/api/request.ts @@ -15,6 +15,7 @@ import type { } from 'axios' import axios from 'axios' import { ElMessage, ElNotification } from 'element-plus' +import router from '@/conf/router' export interface Result { @@ -62,7 +63,7 @@ request.interceptors.response.use( message: response.data.message, }) setTimeout(() => { - window.location.href = '/oauth/authorize/login' + router.replace('/oauth/authorize/login') }, 1000) break default: -- 2.43.0.windows.1