add duration

This commit is contained in:
Romulus21
2024-02-17 00:02:39 +01:00
parent 335fc8b12b
commit f27ffc1ce8
19 changed files with 248 additions and 48 deletions

View File

@@ -13,7 +13,7 @@ interface TrackerProps {
}
export const TrackerProvider = ({children}: PropsWithChildren) => {
const [currentTimeTracker, setCurrentTimeTracker] = useState(null)
const [currentTimeTracker, setCurrentTimeTracker] = useState<timeTracker|null>(null)
const [toDoTracked, setToDoTracked] = useState<toDo|null>(null)
const {axiosGet, axiosPost, axiosDelete} = useAxiosTools()
@@ -23,7 +23,7 @@ export const TrackerProvider = ({children}: PropsWithChildren) => {
const fetchCurrentTimeTracker = async () => {
try {
const res = await axiosGet(`/api/time-tracker/user`)
const res = await axiosGet(`/api/time-trackers/user`)
setCurrentTimeTracker(res.data)
} catch (error) {
console.error(error)
@@ -32,7 +32,7 @@ export const TrackerProvider = ({children}: PropsWithChildren) => {
const startTrackToDo = async (toDo: toDo) => {
try {
const res = await axiosPost('/api/time-tracker', {todo_id: toDo.id})
const res = await axiosPost('/api/time-trackers', {todo_id: toDo.id})
setCurrentTimeTracker(res.data)
} catch (error) {
console.error(error)
@@ -41,7 +41,7 @@ export const TrackerProvider = ({children}: PropsWithChildren) => {
const stopCurrentTimeTrack = async () => {
try {
const res = await axiosDelete(`/api/time-tracker/user`)
const res = await axiosDelete(`/api/time-trackers/user`)
setCurrentTimeTracker(null)
} catch (error) {
console.error(error)