mirror of
				https://github.com/usememos/memos.git
				synced 2025-10-23 12:47:28 +08:00 
			
		
		
		
	fix: memo import
This commit is contained in:
		
							parent
							
								
									7b668f17f5
								
							
						
					
					
						commit
						c34cbb19bc
					
				
					 2 changed files with 4 additions and 6 deletions
				
			
		|  | @ -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
 | ||||
|  |  | |||
|  | @ -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), | ||||
|     }); | ||||
|   }, | ||||
| }; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue