Add Support for Priority

This commit is contained in:
Mo Tarbin 2024-11-03 22:37:21 -05:00
parent 240633177c
commit 6b0d2fe9cd
6 changed files with 233 additions and 100 deletions

View file

@ -88,7 +88,7 @@ const UpdateChoreAssignee = (id, assignee) => {
return Fetch(`${API_URL}/chores/${id}/assignee`, {
method: 'PUT',
headers: HEADERS(),
body: JSON.stringify({ assignee:Number(assignee) }),
body: JSON.stringify({ assignee: Number(assignee) }),
})
}
@ -108,13 +108,20 @@ const DeleteChore = id => {
}
const SaveChore = chore => {
console.log('chore', chore)
return Fetch(`${API_URL}/chores/`, {
method: 'PUT',
headers: HEADERS(),
body: JSON.stringify(chore),
})
}
const UpdateChorePriority = (id, priority) => {
return Fetch(`${API_URL}/chores/${id}/priority `, {
method: 'PUT',
headers: HEADERS(),
body: JSON.stringify({ priority: priority }),
})
}
const GetChoreHistory = choreId => {
return Fetch(`${API_URL}/chores/${choreId}/history`, {
method: 'GET',
@ -312,8 +319,9 @@ export {
SaveThing,
signUp,
SkipChore,
UpdateChoreAssignee,
UpdateChoreHistory,
UpdateChorePriority,
UpdateThingState,
UpdateUserDetails,
UpdateChoreAssignee,
}

31
src/utils/Priorities.jsx Normal file
View file

@ -0,0 +1,31 @@
import {
HorizontalRule,
KeyboardControlKey,
KeyboardDoubleArrowUp,
PriorityHigh,
} from '@mui/icons-material'
const Priorities = [
{
name: 'P4',
value: 4,
icon: <HorizontalRule />,
},
{
name: 'P3 ',
value: 3,
icon: <KeyboardControlKey />,
},
{
name: 'P2',
value: 2,
icon: <KeyboardDoubleArrowUp />,
},
{
name: 'P1',
value: 1,
icon: <PriorityHigh />,
},
]
export default Priorities