diff --git a/src/utils/Fetcher.jsx b/src/utils/Fetcher.jsx
index 75c8190..5e168c6 100644
--- a/src/utils/Fetcher.jsx
+++ b/src/utils/Fetcher.jsx
@@ -65,6 +65,18 @@ const GetArchivedChores = () => {
headers: HEADERS(),
})
}
+const ArchiveChore = id => {
+ return Fetch(`${API_URL}/chores/${id}/archive`, {
+ method: 'PUT',
+ headers: HEADERS(),
+ })
+}
+const UnArchiveChore = id => {
+ return Fetch(`${API_URL}/chores/${id}/unarchive`, {
+ method: 'PUT',
+ headers: HEADERS(),
+ })
+}
const GetChoreByID = id => {
return Fetch(`${API_URL}/chores/${id}`, {
@@ -348,6 +360,7 @@ const DeleteLabel = id => {
export {
AcceptCircleMemberRequest,
+ ArchiveChore,
CancelSubscription,
createChore,
CreateChore,
@@ -384,6 +397,7 @@ export {
SaveThing,
signUp,
SkipChore,
+ UnArchiveChore,
UpdateChoreAssignee,
UpdateChoreHistory,
UpdateChorePriority,
diff --git a/src/views/Chores/ChoreCard.jsx b/src/views/Chores/ChoreCard.jsx
index 44e8c1f..641daf2 100644
--- a/src/views/Chores/ChoreCard.jsx
+++ b/src/views/Chores/ChoreCard.jsx
@@ -1,4 +1,5 @@
import {
+ Archive,
CancelScheduleSend,
Check,
Delete,
@@ -18,6 +19,7 @@ import {
Report,
SwitchAccessShortcut,
TimesOneMobiledata,
+ Unarchive,
Update,
ViewCarousel,
Webhook,
@@ -43,8 +45,10 @@ import { useNavigate } from 'react-router-dom'
import { API_URL } from '../../Config'
import { UserContext } from '../../contexts/UserContext'
import {
+ ArchiveChore,
MarkChoreComplete,
SkipChore,
+ UnArchiveChore,
UpdateChoreAssignee,
} from '../../utils/Fetcher'
import { getTextColorFromBackgroundColor } from '../../utils/LabelColors'
@@ -137,6 +141,30 @@ const ChoreCard = ({
},
})
}
+ const handleArchive = () => {
+ if (chore.isActive) {
+ ArchiveChore(chore.id).then(response => {
+ if (response.ok) {
+ response.json().then(data => {
+ const newChore = { ...chore, isActive: false }
+
+ onChoreUpdate(newChore, 'archive')
+ })
+ }
+ })
+ } else {
+ UnArchiveChore(chore.id).then(response => {
+ if (response.ok) {
+ response.json().then(data => {
+ const newChore = { ...chore, isActive: true }
+ onChoreUpdate(newChore, 'unarchive')
+ })
+ }
+ })
+ }
+
+ handleMenuClose()
+ }
const handleTaskCompletion = () => {
setIsPendingCompletion(true)
@@ -691,6 +719,12 @@ const ChoreCard = ({
View
+
+
+