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,
|
||||
ShareUpdateRequest
|
||||
} from '@/api/asset_interfaces/shared_interfaces';
|
||||
import { serverFetch } from '@/api/createServerInstance';
|
||||
|
||||
export const dashboardsGetList = async (params: {
|
||||
/** The page number to fetch */
|
||||
|
@ -42,6 +43,17 @@ export const dashboardsGetDashboard = async ({
|
|||
.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: {
|
||||
/** The name of the dashboard */
|
||||
name?: string;
|
||||
|
|
|
@ -11,6 +11,7 @@ export const prefetchGetMetric = async (
|
|||
queryClientProp?: QueryClient
|
||||
) => {
|
||||
const queryClient = queryClientProp || new QueryClient();
|
||||
|
||||
await queryClient.prefetchQuery({
|
||||
...metricsQueryKeys.metricsGetMetric(params.id, params.version_number),
|
||||
queryFn: async () => {
|
||||
|
|
|
@ -41,9 +41,11 @@ export const serverFetch = async <T>(url: string, config: FetchConfig = {}): Pro
|
|||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
|
||||
throw {
|
||||
status: response.status,
|
||||
message: response.statusText
|
||||
message: errorText || response.statusText
|
||||
} satisfies RustApiError;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue