From e9745683748ac5ecfdf704607441a3204d8c5516 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sat, 10 Aug 2024 02:08:49 -0400 Subject: Update Fetcher.jsx to include UpdateChoreAssignee function and ChoreCard.jsx to handle assignee change --- src/utils/Fetcher.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/utils/Fetcher.jsx') diff --git a/src/utils/Fetcher.jsx b/src/utils/Fetcher.jsx index 17b6cd9..5b3bbd9 100644 --- a/src/utils/Fetcher.jsx +++ b/src/utils/Fetcher.jsx @@ -83,6 +83,15 @@ const SkipChore = id => { body: JSON.stringify({}), }) } + +const UpdateChoreAssignee = (id, assignee) => { + return Fetch(`${API_URL}/chores/${id}/assignee`, { + method: 'PUT', + headers: HEADERS(), + body: JSON.stringify({ assignee:Number(assignee) }), + }) +} + const CreateChore = chore => { return Fetch(`${API_URL}/chores/`, { method: 'POST', @@ -306,4 +315,5 @@ export { UpdateChoreHistory, UpdateThingState, UpdateUserDetails, + UpdateChoreAssignee, } -- cgit