initial commit

This commit is contained in:
2026-08-09 12:22:40 +02:00
parent a36b2fa801
commit d6dbc1881a
44 changed files with 5787 additions and 1 deletions
+39
View File
@@ -0,0 +1,39 @@
import axios from 'axios';
import { FocusTask, CreateTaskDto, UpdateTaskDto } from './types';
const API_URL = '/api/focustasks';
const api = axios.create({
baseURL: API_URL,
headers: {
'Content-Type': 'application/json',
},
});
export const focusTaskApi = {
getTasks: async (): Promise<FocusTask[]> => {
const { data } = await api.get('');
return data;
},
createTask: async (dto: CreateTaskDto): Promise<FocusTask> => {
const { data } = await api.post('', dto);
return data;
},
updateTask: async (id: number, dto: UpdateTaskDto): Promise<FocusTask> => {
const { data } = await api.put(`/${id}`, dto);
return data;
},
deleteTask: async (id: number): Promise<void> => {
await api.delete(`/${id}`);
},
reorderTasks: async (
orders: Array<{ id: number; order: number }>
): Promise<FocusTask[]> => {
const { data } = await api.put('/reorder', { orders });
return data;
},
};