CEC-4525: add support for /tags endpoint and implement a new action for it (#361)

* add action for adding tags
This commit is contained in:
Tristan Timblin
2023-06-16 11:48:48 -07:00
committed by GitHub
parent 9ae3ef0e2e
commit 7c358a6052
10 changed files with 308 additions and 10 deletions

View File

@@ -17,6 +17,18 @@ const vehiclesAPI = {
.then(fetchRespHandler)
.catch(errorHandler),
addTags: async (vins, tags, token) =>
fetch(`${API_ENDPOINT}/tags`, {
method: "PUT",
headers: Object.assign(
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token),
),
body: JSON.stringify({ vins, tags }),
})
.then(fetchRespHandler)
.catch(errorHandler),
deleteVehicle: async (vin, token) =>
fetch(`${API_ENDPOINT}/vehicle/${vin}`, {
method: "DELETE",