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

View File

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

View File

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