Skip to content

Commit

Permalink
Fix some issues with PUTs.
Browse files Browse the repository at this point in the history
  • Loading branch information
eswan18 committed Aug 31, 2023
1 parent 6f94655 commit 8d1f4b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ export async function post({ route, body }: PostParams): Promise<any> {

type PutParams = {
route: string;
params?: Record<string, string>
body?: string;
}

export async function put({ route, body }: PutParams): Promise<any> {
return await request({route, method: 'PUT', body});
export async function put({ route, params, body }: PutParams): Promise<any> {
return await request({route, method: 'PUT', params, body});
}
2 changes: 1 addition & 1 deletion lib/resources/exercises/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ type OverwriteExerciseParams = {
}

export async function overwriteExercise({id, exercise}: OverwriteExerciseParams): Promise<Exercise> {
return await put({route: `${ROUTE}${id}`, body: JSON.stringify(exercise)}) as Exercise;
return await put({route: `${ROUTE}`, params: {id}, body: JSON.stringify(exercise)}) as Exercise;
}

0 comments on commit 8d1f4b5

Please sign in to comment.