mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 13:47:15 +01:00
Get localized error messages.
This commit is contained in:
parent
baba06c692
commit
fc01ee9f56
32 changed files with 90 additions and 85 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { buildUrl } from '@/lib/url';
|
||||
import { buildPath } from '@/lib/url';
|
||||
|
||||
export interface ErrorResponse {
|
||||
error: {
|
||||
|
|
@ -36,18 +36,17 @@ export async function request(
|
|||
return {
|
||||
ok: res.ok,
|
||||
status: res.status,
|
||||
data: res.ok ? data : undefined,
|
||||
error: res.ok ? undefined : data,
|
||||
data,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export async function httpGet(path: string, params: object = {}, headers: object = {}) {
|
||||
return request('GET', buildUrl(path, params), undefined, headers);
|
||||
return request('GET', buildPath(path, params), undefined, headers);
|
||||
}
|
||||
|
||||
export async function httpDelete(path: string, params: object = {}, headers: object = {}) {
|
||||
return request('DELETE', buildUrl(path, params), undefined, headers);
|
||||
return request('DELETE', buildPath(path, params), undefined, headers);
|
||||
}
|
||||
|
||||
export async function httpPost(path: string, params: object = {}, headers: object = {}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue