feat:更新依赖
This commit is contained in:
parent
cde38eaa17
commit
637d596a55
2
.env
2
.env
@ -1 +1 @@
|
||||
VITE_API_BASE_URL=http://localhost:3000
|
||||
VITE_API_BASE_URL=http://47.94.224.191:8080
|
5
auto-imports.d.ts
vendored
5
auto-imports.d.ts
vendored
@ -17,12 +17,13 @@ declare global {
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||
const h: typeof import('vue')['h']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const isNewUser: typeof import('./src/api/userApi')['isNewUser']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
const isReadonly: typeof import('vue')['isReadonly']
|
||||
const isRef: typeof import('vue')['isRef']
|
||||
const login: typeof import('./src/api/loginApi')['login']
|
||||
const loginApiTest: typeof import('./src/api/loginApi')['loginApiTest']
|
||||
const login: typeof import('./src/api/userApi')['login']
|
||||
const loginApiTest: typeof import('./src/api/userApi')['loginApiTest']
|
||||
const markRaw: typeof import('vue')['markRaw']
|
||||
const nextTick: typeof import('vue')['nextTick']
|
||||
const onActivated: typeof import('vue')['onActivated']
|
||||
|
@ -1,10 +0,0 @@
|
||||
import http from "@/utils/request";
|
||||
|
||||
//demo
|
||||
export const loginApiTest = () => {
|
||||
return http({
|
||||
url:'/search',
|
||||
method:'get'
|
||||
})
|
||||
}
|
||||
|
10
src/api/userApi.ts
Normal file
10
src/api/userApi.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import http from "@/utils/request";
|
||||
|
||||
//demo
|
||||
export const isNewUser = () => {
|
||||
return http({
|
||||
url:'/api/UserInfo/IsNewUser',
|
||||
method:'GET'
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ interface ApiResponse<T = any> {
|
||||
}
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: `${import.meta.env.VITE_API_BASE_URL as string}/api`, // 从 Vite 环境变量获取 baseURL
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL as string, // 从 Vite 环境变量获取 baseURL
|
||||
timeout: 10000, // 请求超时时间
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
@ -8,6 +8,7 @@
|
||||
import { setToken } from '@/utils/auth';
|
||||
import { useAuth0 } from '@auth0/auth0-vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { isNewUser } from '@/api/userApi';
|
||||
|
||||
const { getAccessTokenSilently } = useAuth0();
|
||||
const router = useRouter();
|
||||
@ -16,6 +17,8 @@ const oSomethingWithToken = async () => {
|
||||
try {
|
||||
const token = await getAccessTokenSilently();
|
||||
setToken(token);
|
||||
const res = await isNewUser();
|
||||
console.log(res,'res');
|
||||
message.success('登录成功!');
|
||||
router.push('/layout');
|
||||
} catch (error) {
|
||||
|
@ -206,7 +206,6 @@
|
||||
import { ChevronForward, GitCompare, BarChartSharp, Server } from '@vicons/ionicons5';
|
||||
import { useAuth0 } from '@auth0/auth0-vue';
|
||||
import { useDialog, useMessage } from 'naive-ui';
|
||||
// import { loginApiTest } from '@/api/loginApi'
|
||||
const dialog = useDialog();
|
||||
const message = useMessage();
|
||||
const handleDemo = async () => {
|
||||
|
@ -3,7 +3,7 @@ import vue from "@vitejs/plugin-vue";
|
||||
import { fileURLToPath, URL } from "url";
|
||||
import AutoImport from "unplugin-auto-import/vite";
|
||||
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
||||
import path from 'path';
|
||||
import path from "path";
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
@ -28,9 +28,9 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://localhost:3000/api",
|
||||
target: "http://47.94.224.191:8080", // 去掉末尾的 /api
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\api/, ""),
|
||||
rewrite: (path) => path.replace(/^\/api/, ""), // 修正正则表达式
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user