From de870b075dff722ce30681e02b704e6d30ce7669 Mon Sep 17 00:00:00 2001 From: MoonTestUse1 Date: Wed, 1 Jan 2025 22:40:43 +0600 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D0=B8=D0=BD=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D0=BA=D0=B8=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/composables/useRequests.ts | 11 +++++++-- frontend/src/utils/labels.ts | 32 ++++++++++++------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/frontend/src/composables/useRequests.ts b/frontend/src/composables/useRequests.ts index ee6754b..4cadcd2 100644 --- a/frontend/src/composables/useRequests.ts +++ b/frontend/src/composables/useRequests.ts @@ -1,12 +1,19 @@ import { ref } from 'vue'; -import type { Request } from '@/types/request'; + +interface Request { + id: number; + employee_last_name: string; + request_type: string; + status: string; + created_at: string; +} export function useRequests() { const requests = ref([]); const fetchRequests = async () => { try { - const response = await fetch('/api/admin/requests'); + const response = await fetch('/api/requests/'); if (!response.ok) throw new Error('Failed to fetch requests'); requests.value = await response.json(); } catch (error) { diff --git a/frontend/src/utils/labels.ts b/frontend/src/utils/labels.ts index bfe0e48..b6e72e3 100644 --- a/frontend/src/utils/labels.ts +++ b/frontend/src/utils/labels.ts @@ -1,22 +1,20 @@ -const STATUS_LABELS: Record = { +export const getRequestTypeLabel = (type: string): string => { + const types: Record = { + hardware: 'Оборудование', + software: 'Программное обеспечение', + network: 'Сеть', + access: 'Доступ', + other: 'Другое' + }; + return types[type] || type; +}; + +export const getStatusLabel = (status: string): string => { + const statuses: Record = { new: 'Новая', in_progress: 'В работе', resolved: 'Решена', closed: 'Закрыта' }; - - const REQUEST_TYPE_LABELS: Record = { - hardware: 'Проблемы с оборудованием', - software: 'Проблемы с ПО', - network: 'Проблемы с сетью', - access: 'Доступ к системам', - other: 'Другое' - }; - - export const getStatusLabel = (status: string): string => { - return STATUS_LABELS[status] || status; - }; - - export const getRequestTypeLabel = (type: string): string => { - return REQUEST_TYPE_LABELS[type] || type; - }; \ No newline at end of file + return statuses[status] || status; +}; \ No newline at end of file