fix: 已登录用户本地与云端不一致则提示
This commit is contained in:
11
app/page.jsx
11
app/page.jsx
@@ -3339,13 +3339,10 @@ export default function HomePage() {
|
|||||||
const cloudComparable = getComparablePayload(data.data);
|
const cloudComparable = getComparablePayload(data.data);
|
||||||
|
|
||||||
if (localComparable !== cloudComparable) {
|
if (localComparable !== cloudComparable) {
|
||||||
const cloudTime = new Date(data.updated_at || 0).getTime();
|
// 如果数据不一致,无论时间戳如何,都提示用户
|
||||||
const localTime = new Date(localStorage.getItem('localUpdatedAt') || 0).getTime();
|
// 用户可以选择使用本地数据覆盖云端,或者使用云端数据覆盖本地
|
||||||
|
setCloudConfigModal({ open: true, userId, type: 'conflict', cloudData: data.data });
|
||||||
if (localTime > cloudTime + 2000) {
|
return;
|
||||||
setCloudConfigModal({ open: true, userId, type: 'conflict', cloudData: data.data });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await applyCloudConfig(data.data, data.updated_at);
|
await applyCloudConfig(data.data, data.updated_at);
|
||||||
|
|||||||
Reference in New Issue
Block a user