Skip to content

Commit

Permalink
fix: typo, add missing case
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed Dec 18, 2019
1 parent ea6b9bf commit 25f7e6f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/extension/options-page/DashboardDialogs/Database.tsx
Expand Up @@ -28,7 +28,7 @@ export function DatabaseRestoreDialog() {
const history = useHistory()
const [json, setJson] = React.useState<BackupJSONFileLatest | null>(null)
const [restoreState, setRestoreState] = React.useState<'success' | Error | null>(null)
const [requiredPermissions, setRequiredPermssions] = React.useState<string[] | null>(null)
const [requiredPermissions, setRequiredPermissions] = React.useState<string[] | null>(null)
const fileReceiver = async (e: React.ChangeEvent<HTMLInputElement>) => {
const fr = new FileReader()
fr.readAsText(e.currentTarget.files![0])
Expand All @@ -42,7 +42,7 @@ export function DatabaseRestoreDialog() {
if (!permissions) await Services.Welcome.restoreBackup(json)
else {
setJson(json)
setRequiredPermssions(permissions)
setRequiredPermissions(permissions)
}
setRestoreState('success')
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/extension/options-page/DashboardInitSteps/Step1R.tsx
Expand Up @@ -67,7 +67,7 @@ export default function InitStep1R() {
const [json, setJson] = React.useState<BackupJSONFileLatest | null>(null)
const [textValue, setTextValue] = React.useState('')
const [restoreState, setRestoreState] = React.useState<'success' | Error | null>(null)
const [requiredPermissions, setRequiredPermssions] = React.useState<string[] | null>(null)
const [requiredPermissions, setRequiredPermissions] = React.useState<string[] | null>(null)
const history = useHistory()
const { dragEvents, fileReceiver, fileRef, dragStatus } = useDragAndDrop(file => {
const fr = new FileReader()
Expand All @@ -85,7 +85,7 @@ export default function InitStep1R() {
`2r?personas=${json.personas?.length}&profiles=${json.profiles?.length}&posts=${json.posts?.length}&contacts=${json.userGroups?.length}&date=${json._meta_?.createdAt}`,
),
)
setRequiredPermssions(permissions)
setRequiredPermissions(permissions)
setRestoreState('success')
} catch (e) {
console.error(e)
Expand Down
11 changes: 10 additions & 1 deletion src/social-network/utils/getCurrentNetworkUI.ts
@@ -1,4 +1,11 @@
import { GroupIdentifier, Identifier, ProfileIdentifier, PostIdentifier, PostIVIdentifier } from '../../database/type'
import {
GroupIdentifier,
Identifier,
ProfileIdentifier,
PostIdentifier,
PostIVIdentifier,
ECKeyIdentifier,
} from '../../database/type'
import { definedSocialNetworkUIs, SocialNetworkUIDefinition } from '../ui'

const find = (network: string) => (v: SocialNetworkUIDefinition) => v.networkIdentifier === network
Expand All @@ -17,5 +24,7 @@ export default function getCurrentNetworkUI(network: string | Identifier): Socia
if (network instanceof GroupIdentifier) return getCurrentNetworkUI(network.network)
if (network instanceof PostIdentifier) return getCurrentNetworkUI(network.identifier)
if (network instanceof PostIVIdentifier) return getCurrentNetworkUI(network.network)
if (network instanceof ECKeyIdentifier)
throw new TypeError("It's impossible to search provider for PersonaIdentifier")
throw new TypeError('unknown subclass of Identifier')
}

0 comments on commit 25f7e6f

Please sign in to comment.