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:
Hayden 2023-02-05 12:12:54 -09:00 committed by GitHub
parent 7b28973c60
commit bd06fdafaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 637 additions and 133 deletions

View file

@ -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) {