Started to work on media upload and organization
This commit is contained in:
@@ -10,7 +10,7 @@ export interface ApiResponse<T> {
|
||||
data?: T;
|
||||
}
|
||||
|
||||
async function request<T>(
|
||||
export async function request<T>(
|
||||
url: string,
|
||||
options: {
|
||||
method?: "GET" | "POST" | "PATCH" | "DELETE";
|
||||
@@ -81,14 +81,14 @@ async function mutationHandler<T, A>(
|
||||
}
|
||||
|
||||
export function useApi<T>(
|
||||
url: string,
|
||||
endpoint: string,
|
||||
config?: SWRConfiguration,
|
||||
requiresAuth: boolean = true,
|
||||
csrfToken?: boolean,
|
||||
) {
|
||||
const swr = useSWR<ApiResponse<T>>(
|
||||
url,
|
||||
() => fetcher(url, requiresAuth, csrfToken),
|
||||
endpoint,
|
||||
() => fetcher(endpoint, requiresAuth, csrfToken),
|
||||
config,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user