diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/Fetcher.jsx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/utils/Fetcher.jsx b/src/utils/Fetcher.jsx index 0acc91f..afa9235 100644 --- a/src/utils/Fetcher.jsx +++ b/src/utils/Fetcher.jsx @@ -57,11 +57,20 @@ const GetChoreDetailById = id => { headers: HEADERS(), }) } - -const MarkChoreComplete = id => { - return Fetch(`${API_URL}/chores/${id}/do`, { +const MarkChoreComplete = (id, note, completedDate) => { + const body = { + note, + } + let completedDateFormated = '' + if (completedDate) { + completedDateFormated = `?completedDate=${new Date( + completedDate, + ).toISOString()}` + } + return Fetch(`${API_URL}/chores/${id}/do${completedDateFormated}`, { method: 'POST', headers: HEADERS(), + body: JSON.stringify(body), }) } const CreateChore = chore => { |