initial commit
This commit is contained in:
22
app/repositories/lists.repository.ts
Normal file
22
app/repositories/lists.repository.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user