fix: bug in bind space account in models dialog

This commit is contained in:
Junyan Qin
2026-01-05 20:53:35 +08:00
parent 68ef7bd2c4
commit aa0a501ade

View File

@@ -206,8 +206,23 @@ export default function ModelsDialog({
}
}
function handleSpaceLogin() {
window.location.href = '/auth/space';
async function handleSpaceLogin() {
try {
const token = localStorage.getItem('token');
if (!token) {
toast.error(t('common.error'));
return;
}
const currentOrigin = window.location.origin;
const redirectUri = `${currentOrigin}/auth/space/callback?mode=bind`;
const response = await httpClient.getSpaceAuthorizeUrl(
redirectUri,
token,
);
window.location.href = response.authorize_url;
} catch {
toast.error(t('common.spaceLoginFailed'));
}
}
async function handleAddModel(