forked from mirrors/homebox
feat: enhanced search functions (#260)
* make login case insensitive * expand query to support by Field and By AID search * type generation * new API callers * rework search to support field queries * improve unnecessary data fetches * clear stores on logout * change verbage * add labels
This commit is contained in:
parent
7b28973c60
commit
bd06fdafaf
18 changed files with 637 additions and 133 deletions
|
@ -5,8 +5,7 @@ export enum Method {
|
|||
DELETE = "DELETE",
|
||||
}
|
||||
|
||||
export type RequestInterceptor = (r: Response) => void;
|
||||
export type ResponseInterceptor = (r: Response) => void;
|
||||
export type ResponseInterceptor = (r: Response, rq?: RequestInit) => void;
|
||||
|
||||
export interface TResponse<T> {
|
||||
status: number;
|
||||
|
@ -32,8 +31,8 @@ export class Requests {
|
|||
this.responseInterceptors.push(interceptor);
|
||||
}
|
||||
|
||||
private callResponseInterceptors(response: Response) {
|
||||
this.responseInterceptors.forEach(i => i(response));
|
||||
private callResponseInterceptors(response: Response, request?: RequestInit) {
|
||||
this.responseInterceptors.forEach(i => i(response, request));
|
||||
}
|
||||
|
||||
private url(rest: string): string {
|
||||
|
@ -90,7 +89,7 @@ export class Requests {
|
|||
}
|
||||
|
||||
const response = await fetch(this.url(rargs.url), payload);
|
||||
this.callResponseInterceptors(response);
|
||||
this.callResponseInterceptors(response, payload);
|
||||
|
||||
const data: T = await (async () => {
|
||||
if (response.status === 204) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue