diff --git a/src/api/auth/index.ts b/src/api/auth/index.ts index 12c7a62..7f8ae3a 100644 --- a/src/api/auth/index.ts +++ b/src/api/auth/index.ts @@ -26,9 +26,9 @@ const AuthAPI = { * @param code 微信登录code * @returns 返回 token */ - wxlogin(code: string): Promise { + wechatLogin(code: string): Promise { return request({ - url: "/api/v1/auth/wxlogin", + url: "/api/v1/auth/wechat-login", method: "POST", data: { code }, header: { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 3644460..e1e0f85 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -24,7 +24,7 @@ export const useUserStore = defineStore("user", () => { // 微信登录 const loginByWechat = (code: string) => { return new Promise((resolve, reject) => { - AuthAPI.wxlogin(code) + AuthAPI.wechatLogin(code) .then((data) => { setToken(data.accessToken); resolve(data); @@ -34,7 +34,6 @@ export const useUserStore = defineStore("user", () => { reject(error); }); }); - // return AuthAPI.wxlogin(code); }; // 获取用户信息