🐛 fixed the third-party login bug
This commit is contained in:
@@ -73,25 +73,23 @@ async function getQQRedirectUrl() {
|
||||
* 获取client_id
|
||||
*/
|
||||
async function getClientId() {
|
||||
const id: string | null = localStorage.getItem('client_id');
|
||||
if (!id) {
|
||||
const res: any = await generateClientId();
|
||||
if (res.code === 0 && res.data) {
|
||||
localStorage.setItem('client_id', res.data);
|
||||
}
|
||||
const client = useStore().client;
|
||||
const res: any = await generateClientId();
|
||||
if (res.code === 0 && res.data) {
|
||||
client.setClientId(res.data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地client_id
|
||||
*/
|
||||
function getLocalClientId(): string | null {
|
||||
const clientID: string | null = localStorage.getItem('client_id');
|
||||
if (clientID) {
|
||||
return clientID;
|
||||
function getLocalClientId() {
|
||||
const client = useStore().client;
|
||||
if (client.getClientId()) {
|
||||
return client.getClientId();
|
||||
} else {
|
||||
getClientId();
|
||||
return localStorage.getItem('client_id');
|
||||
return client.getClientId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +124,11 @@ function openGithubUrl() {
|
||||
setTimeout(() => {
|
||||
router.push('/main');
|
||||
}, 1000);
|
||||
} else {
|
||||
message.error(t('login.loginError'));
|
||||
window.removeEventListener("message", messageHandler);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
window.addEventListener("message", messageHandler);
|
||||
@@ -164,6 +166,9 @@ function openGiteeUrl() {
|
||||
setTimeout(() => {
|
||||
router.push('/main');
|
||||
}, 1000);
|
||||
} else {
|
||||
message.error(t('login.loginError'));
|
||||
window.removeEventListener("message", messageHandler);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -201,7 +206,11 @@ function openQQUrl() {
|
||||
setTimeout(() => {
|
||||
router.push('/main');
|
||||
}, 1000);
|
||||
} else {
|
||||
message.error(t('login.loginError'));
|
||||
window.removeEventListener("message", messageHandler);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
window.addEventListener("message", messageHandler);
|
||||
|
Reference in New Issue
Block a user