mirror of
https://github.com/hay-kot/homebox.git
synced 2025-05-23 13:52:26 +00:00
ui cleanup
This commit is contained in:
parent
bf2ad30609
commit
6263278ff5
14 changed files with 253 additions and 130 deletions
|
@ -33,15 +33,15 @@ export interface Item {
|
|||
|
||||
export class ItemsApi extends BaseAPI {
|
||||
async getAll() {
|
||||
return this.http.get<Results<Item>>(route('/items'));
|
||||
return this.http.get<Results<Item>>({ url: route('/items') });
|
||||
}
|
||||
|
||||
async create(item: ItemCreate) {
|
||||
return this.http.post<ItemCreate, Item>(route('/items'), item);
|
||||
return this.http.post<ItemCreate, Item>({ url: route('/items'), body: item });
|
||||
}
|
||||
|
||||
async get(id: string) {
|
||||
const payload = await this.http.get<Item>(route(`/items/${id}`));
|
||||
const payload = await this.http.get<Item>({ url: route(`/items/${id}`) });
|
||||
|
||||
if (!payload.data) {
|
||||
return payload;
|
||||
|
@ -55,10 +55,17 @@ export class ItemsApi extends BaseAPI {
|
|||
}
|
||||
|
||||
async delete(id: string) {
|
||||
return this.http.delete<void>(route(`/items/${id}`));
|
||||
return this.http.delete<void>({ url: route(`/items/${id}`) });
|
||||
}
|
||||
|
||||
async update(id: string, item: ItemCreate) {
|
||||
return this.http.put<ItemCreate, Item>(route(`/items/${id}`), item);
|
||||
return this.http.put<ItemCreate, Item>({ url: route(`/items/${id}`), body: item });
|
||||
}
|
||||
|
||||
async import(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('csv', file);
|
||||
|
||||
return this.http.post<FormData, void>({ url: route('/items/import'), data: formData });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,22 +16,22 @@ export type Label = LabelCreate &
|
|||
|
||||
export class LabelsApi extends BaseAPI {
|
||||
async getAll() {
|
||||
return this.http.get<Results<Label>>(route('/labels'));
|
||||
return this.http.get<Results<Label>>({ url: route('/labels') });
|
||||
}
|
||||
|
||||
async create(label: LabelCreate) {
|
||||
return this.http.post<LabelCreate, Label>(route('/labels'), label);
|
||||
async create(body: LabelCreate) {
|
||||
return this.http.post<LabelCreate, Label>({ url: route('/labels'), body });
|
||||
}
|
||||
|
||||
async get(id: string) {
|
||||
return this.http.get<Label>(route(`/labels/${id}`));
|
||||
return this.http.get<Label>({ url: route(`/labels/${id}`) });
|
||||
}
|
||||
|
||||
async delete(id: string) {
|
||||
return this.http.delete<void>(route(`/labels/${id}`));
|
||||
return this.http.delete<void>({ url: route(`/labels/${id}`) });
|
||||
}
|
||||
|
||||
async update(id: string, label: LabelUpdate) {
|
||||
return this.http.put<LabelUpdate, Label>(route(`/labels/${id}`), label);
|
||||
async update(id: string, body: LabelUpdate) {
|
||||
return this.http.put<LabelUpdate, Label>({ url: route(`/labels/${id}`), body });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,21 +15,21 @@ export type LocationUpdate = LocationCreate;
|
|||
|
||||
export class LocationsApi extends BaseAPI {
|
||||
async getAll() {
|
||||
return this.http.get<Results<Location>>(route('/locations'));
|
||||
return this.http.get<Results<Location>>({ url: route('/locations') });
|
||||
}
|
||||
|
||||
async create(location: LocationCreate) {
|
||||
return this.http.post<LocationCreate, Location>(route('/locations'), location);
|
||||
async create(body: LocationCreate) {
|
||||
return this.http.post<LocationCreate, Location>({ url: route('/locations'), body });
|
||||
}
|
||||
|
||||
async get(id: string) {
|
||||
return this.http.get<Location>(route(`/locations/${id}`));
|
||||
return this.http.get<Location>({ url: route(`/locations/${id}`) });
|
||||
}
|
||||
async delete(id: string) {
|
||||
return this.http.delete<void>(route(`/locations/${id}`));
|
||||
return this.http.delete<void>({ url: route(`/locations/${id}`) });
|
||||
}
|
||||
|
||||
async update(id: string, location: LocationUpdate) {
|
||||
return this.http.put<LocationUpdate, Location>(route(`/locations/${id}`), location);
|
||||
async update(id: string, body: LocationUpdate) {
|
||||
return this.http.put<LocationUpdate, Location>({ url: route(`/locations/${id}`), body });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue