aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/Fetcher.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/Fetcher.jsx')
-rw-r--r--src/utils/Fetcher.jsx15
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 => {