Skip to content

Commit

Permalink
fix: 适配邮箱账号登录
Browse files Browse the repository at this point in the history
  • Loading branch information
chesha1 committed Jun 26, 2024
1 parent 7a396e1 commit faf269c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ async function Login(payload: loginPayload): Promise<string> {
try {
const response: AxiosResponse = await axios.post('https://gf2-bbs-api.sunborngame.com/login/account', payload);
console.log(response.data);
return response.data.data.account.token as string;
if (response.data.code === 0) {
return response.data.data.account.token as string;
}
else {
payload.source = 'mail';
const response: AxiosResponse = await axios.post('https://gf2-bbs-api.sunborngame.com/login/account', payload);
console.log(response.data);
return response.data.data.account.token as string;
}
}
catch (error) {
if (axios.isAxiosError(error)) {
Expand Down

0 comments on commit faf269c

Please sign in to comment.