mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-22 14:49:40 +02:00
refactor(frontend): ♻️ rewrite search componenets to typescript
This commit is contained in:
parent
1981e191be
commit
bde885dc84
25 changed files with 826 additions and 113 deletions
|
@ -1,6 +1,5 @@
|
|||
import axios, { AxiosResponse } from "axios";
|
||||
|
||||
|
||||
interface RequestResponse<T> {
|
||||
response: AxiosResponse<T> | null;
|
||||
data: T | null;
|
||||
|
@ -21,9 +20,9 @@ const request = {
|
|||
};
|
||||
|
||||
export const requests = {
|
||||
async get<T>(url: string, queryParams = {}): Promise<RequestResponse<T>> {
|
||||
async get<T>(url: string, params = {}): Promise<RequestResponse<T>> {
|
||||
let error = null;
|
||||
const response = await axios.get<T>(url, { params: { queryParams } }).catch((e) => {
|
||||
const response = await axios.get<T>(url, { ...params }).catch((e) => {
|
||||
error = e;
|
||||
});
|
||||
if (response != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue