登录刷新code

main
king 1 year ago
parent 4556afa855
commit d1d1dec42e
  1. 10
      src/api/user.ts
  2. 4
      src/pages/login/login.tsx

@ -1,10 +1,12 @@
import {request} from "./request";
interface Code {
image: string
}
interface Login {
access_token: string
code?: {
image: string
}
code?: Code
company: Company
token: string
user: User
@ -48,6 +50,6 @@ export const userApi = {
return request<DepListData>(`/api/v1/user/detail`, "GET")
},
code(catch_key: string) {
return request(`/api/v1/auth/login/code`, "GET", {open_id:catch_key})
return request<{ code: Code }>(`/api/v1/auth/login/code`, "POST", {openid: catch_key})
}
}

@ -26,8 +26,8 @@ const Bing: FC<BingProps> = ({code, catch_key}: BingProps) => {
async function refreshCode() {
try {
await userApi.code(catch_key)
const {code} = await userApi.code(catch_key)
setUseCode(code.image)
} catch (e) {
}
}

Loading…
Cancel
Save