Skip to content

Commit

Permalink
refactor!(timers): Updating timers should be a PUT instead of a POST
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Jun 9, 2022
1 parent 560a50e commit 9c57f0c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/lib/webserver/TimerRouter.js
Expand Up @@ -79,7 +79,7 @@ class TimerRouter {
}
});

this.router.post("/:id", this.validator, (req, res) => {
this.router.put("/:id", this.validator, (req, res) => {
const storedTimers = this.config.get("timers");

if (storedTimers[req.params.id]) {
Expand Down
2 changes: 1 addition & 1 deletion backend/lib/webserver/doc/TimerRouter.openapi.json
Expand Up @@ -136,7 +136,7 @@
}
}
},
"post": {
"put": {
"tags": [
"Timers"
],
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/client.ts
Expand Up @@ -555,7 +555,7 @@ export const sendTimerCreation = async (timerData: Timer): Promise<void> => {

export const sendTimerUpdate = async (timerData: Timer): Promise<void> => {
await valetudoAPI
.post(`/timers/${timerData.id}`, timerData)
.put(`/timers/${timerData.id}`, timerData)
.then(({ status }) => {
if (status !== 200) {
throw new Error("Could not update timer");
Expand Down

0 comments on commit 9c57f0c

Please sign in to comment.