mirror of https://github.com/buster-so/buster.git
start moving to new asset layout
This commit is contained in:
parent
d1335c7f4c
commit
ce21ecd762
|
@ -9,6 +9,7 @@ import {
|
||||||
SharePostRequest,
|
SharePostRequest,
|
||||||
ShareUpdateRequest
|
ShareUpdateRequest
|
||||||
} from '@/api/asset_interfaces/shared_interfaces';
|
} from '@/api/asset_interfaces/shared_interfaces';
|
||||||
|
import { serverFetch } from '@/api/createServerInstance';
|
||||||
|
|
||||||
export const dashboardsGetList = async (params: {
|
export const dashboardsGetList = async (params: {
|
||||||
/** The page number to fetch */
|
/** The page number to fetch */
|
||||||
|
@ -42,6 +43,17 @@ export const dashboardsGetDashboard = async ({
|
||||||
.then((res) => res.data);
|
.then((res) => res.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getDashboard_server = async ({
|
||||||
|
id,
|
||||||
|
password,
|
||||||
|
version_number
|
||||||
|
}: Parameters<typeof dashboardsGetDashboard>[0]) => {
|
||||||
|
return serverFetch<BusterDashboardResponse>(`/dashboards/${id}`, {
|
||||||
|
method: 'GET',
|
||||||
|
params: { password, version_number }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const dashboardsCreateDashboard = async (params: {
|
export const dashboardsCreateDashboard = async (params: {
|
||||||
/** The name of the dashboard */
|
/** The name of the dashboard */
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
|
@ -11,6 +11,7 @@ export const prefetchGetMetric = async (
|
||||||
queryClientProp?: QueryClient
|
queryClientProp?: QueryClient
|
||||||
) => {
|
) => {
|
||||||
const queryClient = queryClientProp || new QueryClient();
|
const queryClient = queryClientProp || new QueryClient();
|
||||||
|
|
||||||
await queryClient.prefetchQuery({
|
await queryClient.prefetchQuery({
|
||||||
...metricsQueryKeys.metricsGetMetric(params.id, params.version_number),
|
...metricsQueryKeys.metricsGetMetric(params.id, params.version_number),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
|
|
@ -41,9 +41,11 @@ export const serverFetch = async <T>(url: string, config: FetchConfig = {}): Pro
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text();
|
||||||
|
|
||||||
throw {
|
throw {
|
||||||
status: response.status,
|
status: response.status,
|
||||||
message: response.statusText
|
message: errorText || response.statusText
|
||||||
} satisfies RustApiError;
|
} satisfies RustApiError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue