mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 18:29:15 +03:00
21 lines
457 B
TypeScript
21 lines
457 B
TypeScript
import { AxiosInstance } from 'axios';
|
|
import { IApiRespose, ICategory } from '@educt/interfaces';
|
|
|
|
export default class CategoryService {
|
|
public api: AxiosInstance;
|
|
|
|
constructor(api: AxiosInstance) {
|
|
this.api = api;
|
|
}
|
|
|
|
/**
|
|
* Feach all categories
|
|
*
|
|
* @returns Array of categories
|
|
*/
|
|
public async fetchAll(): Promise<IApiRespose<ICategory[]>> {
|
|
const result = await this.api.get('/v1/categories');
|
|
return result.data;
|
|
}
|
|
}
|