Skip to content

Commit

Permalink
fix: import data for version above 1.0.0
Browse files Browse the repository at this point in the history
fixes #49
  • Loading branch information
shuowu committed Jul 10, 2020
1 parent b1f7f91 commit a076586
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@
"js-logger": "^1.6.0",
"js-video-url-parser": "^0.4.0",
"markerjs": "^1.8.1",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-highlighter": "^0.4.3",
"react-i18next": "^11.2.6",
"react-recipes": "^1.0.0",
"react-router-dom": "^5.1.2",
"prop-types": "^15.7.2",
"semver-compare": "^1.0.0",
"styled-components": "^5.0.0-rc.2",
"throttle-debounce": "^2.1.0",
"uuidv4": "^6.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import styled from 'styled-components';
import { useStoreActions } from 'easy-peasy';
import { useTranslation } from 'react-i18next';
import cmp from 'semver-compare';
import { Grid, Typography, Button, Divider } from '@material-ui/core';
import {
storage as StorageService,
Expand Down Expand Up @@ -31,7 +32,7 @@ const ExportAndImport = () => {
const handleImportFile = e => {
FileService.readAsJson(e.target.files[0])
.then(({ version, data }) => {
if (version !== '1.0.0') {
if (cmp(version, '1.0.0') === -1) {
throw new Error(t('settings.import.version.error'));
}
return importData(data);
Expand Down

0 comments on commit a076586

Please sign in to comment.