add duration
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user