Explorar el Código

Sort posts by date

master
Dylan Baker hace 3 años
padre
commit
a816e38af1
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3
    0
      src/fs.rs

+ 3
- 0
src/fs.rs Ver fichero

@@ -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
 

Loading…
Cancelar
Guardar