1
0

Обновление бека+фронт

MVP версия - которая уже готова к работе
This commit is contained in:
2026-01-12 01:11:32 +07:00
parent a9c146b192
commit 456876f837
16 changed files with 894 additions and 75 deletions

View File

@@ -31,37 +31,77 @@ export const authApi = {
// ==================== DEPARTMENTS ====================
export const departmentsApi = {
getAll: () => request('/departments', { credentials: 'include' })
getAll: () => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'get_departments' })
})
}
// ==================== LABELS ====================
export const labelsApi = {
getAll: () => request('/labels', { credentials: 'include' })
getAll: () => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'get_labels' })
})
}
// ==================== COLUMNS ====================
export const columnsApi = {
getAll: () => request('/columns', { credentials: 'include' })
getAll: () => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'get_columns' })
})
}
// ==================== CARDS ====================
export const cardsApi = {
getAll: () => request('/cards', { credentials: 'include' }),
create: (data) => request('/cards', {
getAll: () => request('/api/task', { credentials: 'include' }),
updateOrder: (id, column_id, to_index) => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'update_order', id, column_id, to_index })
}),
create: (data) => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
body: JSON.stringify({ action: 'create', ...data })
}),
update: (id, data) => request(`/cards/${id}`, {
method: 'PUT',
update: (data) => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
body: JSON.stringify({ action: 'update', ...data })
}),
delete: (id) => request(`/cards/${id}`, {
method: 'DELETE',
credentials: 'include'
delete: (id) => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'delete', id })
})
}
// ==================== TASK IMAGES ====================
export const taskImageApi = {
upload: (task_id, file_data, file_name) => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'upload_image', task_id, file_data, file_name })
}),
// Принимает строку (один файл) или массив (несколько файлов)
delete: (task_id, file_names) => request('/api/task', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'delete_image', task_id, file_names })
})
}