From 539fd8fd1402aa4ccbe27e9396c69cee2a75341a Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 22 Sep 2022 20:46:12 +0800 Subject: [PATCH] refactor: improve login-related logic (#617) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /milestone 2.0 #### What this PR does / why we need it: 适配 https://github.com/halo-dev/halo/pull/2453 1. 将生产构建的 base url 更改为 console 2. 优化登录之后跳转的逻辑。 #### Which issue(s) this PR fixes: #### Special notes for your reviewer: /cc @halo-dev/sig-halo-admin 测试方式: 1. 在本地根据此 PR 构建生产版本(pnpm build) 2. 根据 https://github.com/halo-dev/halo/pull/2453#issue-1381947867 中的描述修改配置文件。 3. 访问 http://localhost:8090/console #### Does this PR introduce a user-facing change? ```release-note None ``` --- .env.production | 2 +- src/main.ts | 3 +- src/modules/system/users/Login.vue | 52 +++++++----------- src/utils/api-client.ts | 88 ++++++++++++++++-------------- 4 files changed, 70 insertions(+), 75 deletions(-) diff --git a/.env.production b/.env.production index c2660d7d..9eb2c608 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,2 @@ VITE_API_URL= -VITE_BASE_URL=/admin/ +VITE_BASE_URL=/console/ diff --git a/src/main.ts b/src/main.ts index 30769065..0d02194d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,7 +8,7 @@ import type { MenuItemType, Plugin, } from "@halo-dev/admin-shared"; -import { apiClient, setApiUrl } from "@/utils/api-client"; +import { apiClient } from "@/utils/api-client"; import { menus, minimenus, registerMenu } from "./router/menus.config"; // setup import "./setup/setupStyles"; @@ -24,7 +24,6 @@ import { useRoleStore } from "@/stores/role"; const app = createApp(App); setupComponents(app); -setApiUrl(import.meta.env.VITE_API_URL); app.use(createPinia()); diff --git a/src/modules/system/users/Login.vue b/src/modules/system/users/Login.vue index 36e4d7e4..cb2e2515 100644 --- a/src/modules/system/users/Login.vue +++ b/src/modules/system/users/Login.vue @@ -1,12 +1,8 @@