Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
fix(source material): refresh years list after source material update
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao authored Oct 3, 2022
1 parent 9925758 commit 4deacaa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/epub/epubParser.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { loadEPUB } from 'jw-epub-parser';
import dateFormat from 'dateformat';
import { promiseGetRecoil } from 'recoil-outside';
import { dbSaveSrcData } from '../indexedDb/dbSourceMaterial';
import { promiseGetRecoil, promiseSetRecoil } from 'recoil-outside';
import { dbSaveSrcData, dbGetYearList } from '../indexedDb/dbSourceMaterial';
import { monthNamesState } from '../appStates/appSettings';
import { assTypeLocalState } from '../appStates/appSourceMaterial';
import { assTypeLocalState, yearsListState } from '../appStates/appSourceMaterial';

export const addEpubDataToDb = async (fileEPUB) => {
const data = await loadEPUB(fileEPUB);
Expand Down Expand Up @@ -202,6 +202,9 @@ const addDataToDb = async (data) => {

await dbSaveSrcData(obj);
}

const years = await dbGetYearList();
await promiseSetRecoil(yearsListState, years);
} catch (err) {
return 'error';
}
Expand Down

0 comments on commit 4deacaa

Please sign in to comment.