use PUT for routing options

This commit is contained in:
Gwendolyn 2023-12-21 01:26:47 +01:00
parent a4074cee3a
commit d4b7e2bc38
2 changed files with 15 additions and 1 deletions

View file

@ -818,7 +818,7 @@ c3nav = {
options[$(this).attr('name')] = $(this).val();
});
if ($(this).is('.save')) {
c3nav_api.post('routing/options', options);
c3nav_api.put('routing/options', options);
}
c3nav.next_route_options = options;
c3nav.update_state(null, null, null, false);

View file

@ -60,6 +60,20 @@
})
.then(res => res.json())
}
put(path, data) {
return fetch(this.make_url(path), {
credentials: 'include',
method: 'PUT',
headers: {
'X-API-Key': this.key,
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
})
.then(res => res.json())
}
}
window.c3nav_api = new C3NavApi(`${window.location.origin}/api/v2/`);