From 79d15338b8be3ab542cb8061262ecc1abaa046f0 Mon Sep 17 00:00:00 2001 From: kitce Date: Mon, 10 Jan 2022 02:59:57 +0800 Subject: [PATCH] fix(cloud-sync): set error to `null` after finish --- src/helpers/cloud.ts | 1 + src/store/slices/sync.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers/cloud.ts b/src/helpers/cloud.ts index 2d5d197..0a829c5 100644 --- a/src/helpers/cloud.ts +++ b/src/helpers/cloud.ts @@ -62,6 +62,7 @@ export const sync = async () => { await upload(file.id!, json); const now = Date.now(); dispatch(metaActions.setLastSyncedTime(now)); + dispatch(syncActions.setError(null)); } catch (err) { dispatch(syncActions.setError(err)); } diff --git a/src/store/slices/sync.ts b/src/store/slices/sync.ts index 35cdafa..976e152 100644 --- a/src/store/slices/sync.ts +++ b/src/store/slices/sync.ts @@ -18,7 +18,7 @@ const slice = createSlice({ const { payload } = action; state.loading = payload; }, - setError: (state, action: PayloadAction) => { + setError: (state, action: PayloadAction) => { const { payload } = action; state.error = payload; }