mirror of
https://github.com/hulthe/inkopslista.git
synced 2026-08-03 23:11:28 +02:00
sync list updates with server
This commit is contained in:
@@ -42,7 +42,7 @@ fn put_list(item: &str, data: Json<ItemData>, mock_db: &State<Mutex<MockDb>>) {
|
||||
}
|
||||
|
||||
#[delete("/api/list/<item>")]
|
||||
fn delete_trip(item: &str, mock_db: &State<Mutex<MockDb>>) {
|
||||
fn delete_item(item: &str, mock_db: &State<Mutex<MockDb>>) {
|
||||
let mut mock_db = mock_db.lock().unwrap();
|
||||
if let Some(index) = mock_db.list.iter().position(|x| x.name == item) {
|
||||
mock_db.list.remove(index);
|
||||
@@ -53,7 +53,7 @@ fn delete_trip(item: &str, mock_db: &State<Mutex<MockDb>>) {
|
||||
fn rocket() -> _ {
|
||||
rocket::build()
|
||||
.manage(Mutex::new(MockDb::default()))
|
||||
.mount("/", routes![index, get_list, put_list, delete_trip])
|
||||
.mount("/", routes![index, get_list, put_list, delete_item])
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user