Add ability to manually adjust the running timer's start time
Allows users to retroactively correct the start time of an ongoing timer without stopping it. A pencil icon in the timer widget opens an inline time input pre-filled with the current start time; confirming sends the new time to the backend which validates it is in the past before persisting.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import apiClient from './client';
|
||||
import type { OngoingTimer, TimeEntry } from '@/types';
|
||||
|
||||
export interface UpdateTimerPayload {
|
||||
projectId?: string | null;
|
||||
startTime?: string;
|
||||
}
|
||||
|
||||
export const timerApi = {
|
||||
getOngoing: async (): Promise<OngoingTimer | null> => {
|
||||
const { data } = await apiClient.get<OngoingTimer | null>('/timer');
|
||||
@@ -14,10 +19,8 @@ export const timerApi = {
|
||||
return data;
|
||||
},
|
||||
|
||||
update: async (projectId?: string | null): Promise<OngoingTimer> => {
|
||||
const { data } = await apiClient.put<OngoingTimer>('/timer', {
|
||||
projectId,
|
||||
});
|
||||
update: async (payload: UpdateTimerPayload): Promise<OngoingTimer> => {
|
||||
const { data } = await apiClient.put<OngoingTimer>('/timer', payload);
|
||||
return data;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user