fix(marketplace): 登录成功写 prefs 失败时补回 .catch
重构 OAuth 登录为 GithubLoginModal 后,onLoginSuccess / MarketplaceSection onSuccess 用裸 void updatePrefs(...) 写 marketplaceDevLogin,丢掉了重构前 try/catch 里的失败日志 —— prefs 写入失败会冒成未处理的 promise rejection。 补回 .catch + console.warn,与重构前行为一致。
This commit is contained in:
1 parent
0689442148
commit
038744fe40
2 files changed
+6
-2
No files matched your search
@@ -396,7 +396,10 @@ export function Marketplace() {
|
||||
|
||||
// GitHub 登录成功 → 写回 prefs.marketplaceDevLogin,让后续 X-Dev-User 走真实身份。
|
||||
const onLoginSuccess = useCallback((nextLogin: string) => {
|
||||
void updatePrefs(current => ({ ...current, marketplaceDevLogin: nextLogin }));
|
||||
// prefs 写入失败只 console 记一笔(与重构前的 OAuth 轮询一致)—— 不能裸 void,
|
||||
// 否则 reject 会冒成未处理的 promise rejection。
|
||||
void updatePrefs(current => ({ ...current, marketplaceDevLogin: nextLogin }))
|
||||
.catch(e => console.warn('[marketplace] save login to prefs failed', e));
|
||||
setActionMsg({ kind: 'ok', text: t('marketplace.oauth.successAs', { login: nextLogin }) });
|
||||
}, [updatePrefs, t]);
|
||||
|
||||
|
||||
@@ -98,7 +98,8 @@ export function MarketplaceSection() {
|
||||
<GithubLoginModal
|
||||
onClose={() => setShowLogin(false)}
|
||||
onSuccess={nextLogin => {
|
||||
void savePrefs(current => ({ ...current, marketplaceDevLogin: nextLogin }));
|
||||
void savePrefs(current => ({ ...current, marketplaceDevLogin: nextLogin }))
|
||||
.catch(e => console.warn('[marketplace] save login to prefs failed', e));
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user