ソースを参照

Sort posts by date

master
Dylan Baker 3年前
コミット
a816e38af1
1個のファイルの変更3行の追加0行の削除
  1. 3
    0
      src/fs.rs

+ 3
- 0
src/fs.rs ファイルの表示

@@ -19,6 +19,9 @@ pub async fn get_all_posts() -> Result<Vec<Post>, Error> {
19 19
         }
20 20
     }
21 21
 
22
+    posts.sort_by_key(|el| el.date.clone());
23
+    posts.reverse();
24
+
22 25
     Ok(posts)
23 26
 }
24 27
 

読み込み中…
キャンセル
保存