mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Fixed queries again.
This commit is contained in:
parent
fc640ff394
commit
1ba28ece8b
8 changed files with 26 additions and 21 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { buildUrl } from '@/lib/url';
|
||||
|
||||
export async function request(method: string, url: string, body?: string, headers: object = {}) {
|
||||
const res = await fetch(url, {
|
||||
return fetch(url, {
|
||||
method,
|
||||
cache: 'no-cache',
|
||||
headers: {
|
||||
|
|
@ -10,22 +10,21 @@ export async function request(method: string, url: string, body?: string, header
|
|||
...headers,
|
||||
},
|
||||
body,
|
||||
});
|
||||
return res.json();
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function httpGet(url: string, params: object = {}, headers: object = {}) {
|
||||
export async function httpGet(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('GET', buildUrl(url, params), undefined, headers);
|
||||
}
|
||||
|
||||
export function httpDelete(url: string, params: object = {}, headers: object = {}) {
|
||||
export async function httpDelete(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('DELETE', buildUrl(url, params), undefined, headers);
|
||||
}
|
||||
|
||||
export function httpPost(url: string, params: object = {}, headers: object = {}) {
|
||||
export async function httpPost(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('POST', url, JSON.stringify(params), headers);
|
||||
}
|
||||
|
||||
export function httpPut(url: string, params: object = {}, headers: object = {}) {
|
||||
export async function httpPut(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('PUT', url, JSON.stringify(params), headers);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue