22 lines
426 B
TypeScript
22 lines
426 B
TypeScript
import type { $Fetch } from 'ofetch';
|
|
import type { List } from '~/types/lists'
|
|
|
|
export default class ListRepository {
|
|
private fetcher: $Fetch;
|
|
|
|
constructor(fetcher: $Fetch) {
|
|
this.fetcher = fetcher;
|
|
}
|
|
|
|
async getAll() {
|
|
return await this.fetcher<List[]>('/lists');
|
|
}
|
|
|
|
async create(data: Partial<List>) {
|
|
return await this.fetcher<List>('/lists', {
|
|
method: 'POST',
|
|
body: data
|
|
});
|
|
|
|
}
|
|
} |