fix: memo import

This commit is contained in:
boojack 2022-05-21 12:42:28 +08:00
parent 7b668f17f5
commit c34cbb19bc
2 changed files with 4 additions and 6 deletions

View file

@ -42,10 +42,10 @@ const PreferencesSection: React.FC<Props> = () => {
for (const memo of memoList) { for (const memo of memoList) {
const content = memo.content || ""; const content = memo.content || "";
const createdAt = utils.getDateTimeString(memo.createdTs || Date.now()); const createdTs = (memo as any).createdAt || memo.createdTs || Date.now();
try { try {
await memoService.importMemo(content, createdAt); await memoService.importMemo(content, createdTs);
succeedAmount++; succeedAmount++;
} catch (error) { } catch (error) {
// do nth // do nth

View file

@ -129,12 +129,10 @@ const memoService = {
await api.unpinMemo(memoId); await api.unpinMemo(memoId);
}, },
importMemo: async (content: string, createdAt: string) => { importMemo: async (content: string, createdTs: TimeStamp) => {
const createdTs = Math.floor(utils.getTimeStampByDate(createdAt) / 1000);
await api.createMemo({ await api.createMemo({
content, content,
createdTs, createdTs: Math.floor(utils.getTimeStampByDate(createdTs) / 1000),
}); });
}, },
}; };