mirror of
https://github.com/SinTan1729/chhoto-url
synced 2025-03-14 05:04:40 -05:00
new: Enforce ordering of data
Closes #46 Data is returned in order of id, which should match the order it was inserted in. In the WebUI, the entries are shown in reverse, so the latest link is at the top.
This commit is contained in:
parent
c557b8b262
commit
6f419c7b3d
2 changed files with 2 additions and 2 deletions
|
@ -33,7 +33,7 @@ pub fn find_url(shortlink: &str, db: &Connection, needhits: bool) -> (Option<Str
|
|||
// Get all URLs in DB
|
||||
pub fn getall(db: &Connection) -> Vec<DBRow> {
|
||||
let mut statement = db
|
||||
.prepare_cached("SELECT * FROM urls")
|
||||
.prepare_cached("SELECT * FROM urls ORDER BY id ASC")
|
||||
.expect("Error preparing SQL statement for getall.");
|
||||
|
||||
let mut data = statement
|
||||
|
|
|
@ -56,7 +56,7 @@ const refreshData = async () => {
|
|||
}
|
||||
} else {
|
||||
let data = await res.json();
|
||||
displayData(data);
|
||||
displayData(data.reverse());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue