fix: 补充同步失败错误提示的情况

This commit is contained in:
hzm
2026-02-08 06:03:00 +08:00
parent d69bf547ac
commit ff4a10c84d

View File

@@ -3362,7 +3362,7 @@ export default function HomePage() {
try { try {
const payload = collectLocalPayload(); const payload = collectLocalPayload();
const now = new Date().toISOString(); const now = new Date().toISOString();
const { error: updateError } = await supabase const { data: upsertData, error: updateError } = await supabase
.from('user_configs') .from('user_configs')
.upsert( .upsert(
{ {
@@ -3371,8 +3371,13 @@ export default function HomePage() {
updated_at: now updated_at: now
}, },
{ onConflict: 'user_id' } { onConflict: 'user_id' }
); )
.select();
if (updateError) throw updateError; if (updateError) throw updateError;
if (!upsertData || upsertData.length === 0) {
throw new Error('同步失败:未写入任何数据,请检查账号状态或重新登录');
}
localStorage.setItem('localUpdatedAt', now); localStorage.setItem('localUpdatedAt', now);