mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-10 23:33:41 -07: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
|
@ -23,9 +23,9 @@ const request = {
|
|||
|
||||
function getRequests(axoisInstance: NuxtAxiosInstance): ApiRequestInstance {
|
||||
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 axoisInstance.get<T>(url, { params: { queryParams } }).catch((e) => {
|
||||
const response = await axoisInstance.get<T>(url, params).catch((e) => {
|
||||
error = e;
|
||||
});
|
||||
if (response != null) {
|
||||
|
@ -53,12 +53,9 @@ function getRequests(axoisInstance: NuxtAxiosInstance): ApiRequestInstance {
|
|||
return requests;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const useApiSingleton = function (): Api {
|
||||
const { $axios } = useContext();
|
||||
const requests = getRequests($axios);
|
||||
|
||||
return new Api(requests)
|
||||
return new Api(requests);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue