Improve MarkChoreComplete, allow complete in past ,etc
This commit is contained in:
parent
df83cc8948
commit
e039b732a8
3 changed files with 228 additions and 92 deletions
|
@ -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 => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue