@electerm/electerm-react 1.40.18 → 1.40.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -161,6 +161,14 @@ export default (Store) => {
161
161
  const { store } = window
162
162
  store.isSyncingSetting = true
163
163
  store.isSyncUpload = true
164
+ await store.uploadSettingAction(type).catch(store.onError)
165
+ store.isSyncingSetting = false
166
+ store.isSyncUpload = false
167
+ window[type + 'IsSyncing'] = false
168
+ }
169
+
170
+ Store.prototype.uploadSettingAction = async function (type) {
171
+ const { store } = window
164
172
  const token = store.getSyncToken(type)
165
173
  let gistId = store.getSyncGistId(type)
166
174
  if (!gistId && type !== syncTypes.cloud && type !== syncTypes.custom) {
@@ -168,9 +176,6 @@ export default (Store) => {
168
176
  gistId = store.getSyncGistId(type)
169
177
  }
170
178
  if (!gistId && type !== syncTypes.custom && type !== syncTypes.cloud) {
171
- window.isSyncing = false
172
- store.isSyncingSetting = false
173
- store.isSyncUpload = false
174
179
  return
175
180
  }
176
181
  const pass = store.getSyncPassword(type)
@@ -218,10 +223,7 @@ export default (Store) => {
218
223
  })
219
224
  }
220
225
  }
221
- }], token, store.getProxySetting()).catch(store.onError)
222
- store.isSyncingSetting = false
223
- store.isSyncUpload = false
224
- window[type + 'IsSyncing'] = false
226
+ }], token, store.getProxySetting())
225
227
  if (res) {
226
228
  store.updateSyncSetting({
227
229
  [type + 'LastSyncTime']: Date.now()
@@ -233,6 +235,13 @@ export default (Store) => {
233
235
  const { store } = window
234
236
  store.isSyncingSetting = true
235
237
  store.isSyncDownload = true
238
+ await store.downloadSettingAction(type).catch(store.onError)
239
+ store.isSyncingSetting = false
240
+ store.isSyncDownload = false
241
+ }
242
+
243
+ Store.prototype.downloadSettingAction = async function (type) {
244
+ const { store } = window
236
245
  const token = store.getSyncToken(type)
237
246
  let gistId = store.getSyncGistId(type)
238
247
  if (!gistId && type !== syncTypes.cloud && type !== syncTypes.custom) {
@@ -256,8 +265,6 @@ export default (Store) => {
256
265
  let str = get(gist, `files["${n}.json"].content`)
257
266
  if (!str) {
258
267
  if (n === settingMap.bookmarks) {
259
- store.isSyncingSetting = false
260
- store.isSyncDownload = false
261
268
  throw new Error(('Seems you have a empty gist, you can try use existing gist ID or upload first'))
262
269
  } else {
263
270
  continue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.40.18",
3
+ "version": "1.40.20",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",