start moving to new asset layout

This commit is contained in:
Nate Kelley 2025-04-07 16:11:33 -06:00
parent d1335c7f4c
commit ce21ecd762
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 16 additions and 1 deletions

View File

@ -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;

View File

@ -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 () => {

View File

@ -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;
}