fix: api test
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { currentClusterAtom } from '@/atoms/gpuservice';
|
||||
import { useModel } from '@@/plugin-model';
|
||||
import { useQueryData } from '@gpustack/core-ui';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { useCallback } from 'react';
|
||||
import { apiVersion, KindMapping } from '../../constants';
|
||||
import { createGPUServiceInstance } from '../apis';
|
||||
@@ -12,12 +14,15 @@ interface CreateInstanceParams {
|
||||
export default function useCreateInstance() {
|
||||
const { initialState } = useModel('@@initialState');
|
||||
const namespace = initialState?.currentUser?.org_name || 'default';
|
||||
const currentCluster = useAtomValue(currentClusterAtom);
|
||||
const clusterID = currentCluster?.id;
|
||||
|
||||
const fetchDetail = useCallback(
|
||||
(params: CreateInstanceParams, option?: any) =>
|
||||
createGPUServiceInstance(
|
||||
{
|
||||
namespace,
|
||||
clusterID,
|
||||
data: {
|
||||
apiVersion,
|
||||
kind: KindMapping.instance,
|
||||
@@ -30,7 +35,7 @@ export default function useCreateInstance() {
|
||||
},
|
||||
option
|
||||
),
|
||||
[namespace]
|
||||
[namespace, clusterID]
|
||||
);
|
||||
|
||||
const { detailData, loading, cancelRequest, fetchData } = useQueryData<
|
||||
|
||||
Reference in New Issue
Block a user