Spaces:
Sleeping
Sleeping
| import { Permission } from '../types'; | |
| import apiClient from '@/lib/api/axios-instance'; | |
| import { createHeaders } from '@/lib/api'; | |
| import { API_BASE_URL } from '../config'; | |
| import axios from 'axios'; | |
| // Permission API service | |
| export const permissionApi = { | |
| getAll: async (): Promise<Permission[]> => { | |
| const response = await apiClient.get(`/api/Permission`); | |
| if (!response.data) { | |
| throw new Error('Failed to fetch permissions'); | |
| } | |
| return response.data; | |
| }, | |
| getById: async (id: number): Promise<Permission> => { | |
| const response = await apiClient.get(`/api/Permission/${id}`); | |
| if (!response.data) { | |
| throw new Error(`Failed to fetch permission with ID ${id}`); | |
| } | |
| return response.data; | |
| }, | |
| }; |