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) {
const content = memo.content || "";
const createdAt = utils.getDateTimeString(memo.createdTs || Date.now());
const createdTs = (memo as any).createdAt || memo.createdTs || Date.now();
try {
await memoService.importMemo(content, createdAt);
await memoService.importMemo(content, createdTs);
succeedAmount++;
} catch (error) {
// do nth

View file

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