remove unnecessary data from article list api endpoint
This commit is contained in:
		
							parent
							
								
									3799357a3e
								
							
						
					
					
						commit
						bb69cf9321
					
				| @ -8,6 +8,7 @@ export async function get(req, res) | ||||
|     if (slug === 'all') { | ||||
|         articles = await Article.find() | ||||
|                                 .sort({ created_at: 'desc' }) | ||||
| 								.select('title slug image created_at views') | ||||
|                                 .populate({ path: 'category' }) | ||||
|                                 .populate({ path: 'author', select: 'realname' }); | ||||
|     } else { | ||||
| @ -23,6 +24,7 @@ export async function get(req, res) | ||||
|         } else { | ||||
|             articles = await Article.find({ category: cat.id }) | ||||
|                                     .sort({ created_at: 'desc' }) | ||||
| 									.select('title slug image created_at views') | ||||
|                                     .populate({ path: 'category' }) | ||||
|                                     .populate({ path: 'author', select: 'realname' }); | ||||
|         } | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
|     { | ||||
|         const res = await this.fetch(`/c/all.json`); | ||||
|         const { articles } = await res.json(); | ||||
|         return { articles }; | ||||
|         return { articles, randomArticle }; | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user