Skip to content

Commit

Permalink
refactor: build params
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui committed Feb 28, 2020
1 parent 5c24975 commit 6251db8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/extension/options-page/DashboardInitSteps/Step1R.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,17 @@ export default function InitStep1R() {
if (!json) throw new Error('UpgradeBackupJSONFile failed')
setJson(json)
const permissions = await extraPermissions(json.grantedHostPermissions)
if (!permissions)
if (!permissions) {
const restoreParams = new URLSearchParams()
restoreParams.append('personas', String(json.personas?.length ?? ''))
restoreParams.append('profiles', String(json.profiles?.length ?? ''))
restoreParams.append('posts', String(json.posts?.length ?? ''))
restoreParams.append('contacts', String(json.userGroups?.length ?? ''))
restoreParams.append('date', String(json._meta_?.createdAt ?? ''))
return await Services.Welcome.restoreBackup(json).then(() =>
history.push(
`${InitStep.Restore2}?personas=${json.personas?.length}&profiles=${json.profiles?.length}&posts=${json.posts?.length}&contacts=${json.userGroups?.length}&date=${json._meta_?.createdAt}`,
),
history.push(`${InitStep.Restore2}?${restoreParams.toString()}`),
)
}
setRequiredPermissions(permissions)
setRestoreState('success')
} catch (e) {
Expand Down

0 comments on commit 6251db8

Please sign in to comment.