Fixed import
This commit is contained in:
@@ -7,7 +7,8 @@ import { fixedEncodeURIComponent } from '../../src/utils'
|
||||
import {
|
||||
GroupRenameBody,
|
||||
GroupSetFactoryArrayBody,
|
||||
SetFactoryArrayBody
|
||||
SetFactoryArrayBody,
|
||||
UploadDataBody
|
||||
} from '../../src/types/ApiSchemasFrontend'
|
||||
import { NextRouter, useRouter } from 'next/router'
|
||||
|
||||
@@ -257,16 +258,19 @@ export const GroupProvider: FC<Props> = ({ children, id, initial }) => {
|
||||
}, [basicValues, excludedSuggestions, groups])
|
||||
|
||||
const load = useCallback(
|
||||
(compressed: Uint8Array) => {
|
||||
async (compressed: Uint8Array) => {
|
||||
// const atob = (str: string) => Buffer.from(str, 'base64')
|
||||
const uncompressed = pako.inflate(compressed, { to: 'string' })
|
||||
const value: StoredFile = JSON.parse(uncompressed)
|
||||
if (!value.groups || !value.basicValues || !value.excludedSuggestions) return
|
||||
setGroups(value.groups)
|
||||
setBasicValues(value.basicValues)
|
||||
setExcludedSuggestions(value.excludedSuggestions)
|
||||
await postFetchJson(router, `/api/${router.query.id}/upload`, {
|
||||
groups: value.groups,
|
||||
ignored: value.excludedSuggestions,
|
||||
base: value.basicValues
|
||||
} as UploadDataBody)
|
||||
router.reload()
|
||||
},
|
||||
[setBasicValues, setExcludedSuggestions]
|
||||
[router]
|
||||
)
|
||||
|
||||
const value: GroupContextType = useMemo(
|
||||
|
||||
Reference in New Issue
Block a user