mirror of
https://github.com/fspc/workstand.git
synced 2026-09-17 00:51:39 -04:00
Create new bikes!
This commit is contained in:
@@ -28,8 +28,8 @@ const Api = {
|
||||
throw error;
|
||||
});
|
||||
},
|
||||
saveBike(data) {
|
||||
return fetch(`/api/v1/bikes/${data.id}/`, {
|
||||
updateBike(data) {
|
||||
return fetch(data.url, {
|
||||
credentials: 'same-origin',
|
||||
method: 'PUT',
|
||||
headers,
|
||||
@@ -43,6 +43,21 @@ const Api = {
|
||||
throw error;
|
||||
});
|
||||
},
|
||||
saveBike(data) {
|
||||
return fetch(`/api/v1/bikes/`, {
|
||||
credentials: 'same-origin',
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then(checkStatus)
|
||||
.then(parseJson)
|
||||
.then(data => data)
|
||||
.catch((error) => {
|
||||
console.log('request failed', error);
|
||||
throw error;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default Api;
|
||||
|
||||
Reference in New Issue
Block a user