Skip to content

Commit

Permalink
chore: add reminder
Browse files Browse the repository at this point in the history
  • Loading branch information
olavis committed Sep 29, 2023
1 parent f85e517 commit abd307b
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/hooks/useAnalogueModels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type UseQueryOptions<T> = ParamsOption<T> &
}

const ANALOGUEMODELS_KEY = '/api/analogue-models'
const ANALOGUEMODEL_KEY = '/api/analogue-models/{id}'
const NC_FILE_KEY = '/api/analogue-models/{id}/input-models'

export function useAnalogueModels(id?: string) {
Expand All @@ -27,18 +26,6 @@ export function useAnalogueModels(id?: string) {
return data
}

async function fetchModel({
params,
}: UseQueryOptions<paths[typeof ANALOGUEMODEL_KEY]['get']>) {
// check id at runtime because it can be undefined
if (params.path.id === undefined) Promise.reject(new Error('Invalid id'))
const { data } = await apiClient.GET(ANALOGUEMODEL_KEY, {
params,
headers: headers,
})
return data
}

async function createModel({
body,
}: UseQueryOptions<paths[typeof ANALOGUEMODELS_KEY]['post']>) {
Expand Down Expand Up @@ -67,6 +54,7 @@ export function useAnalogueModels(id?: string) {
}

const models = useQuery(['models', token], fetchModels, { enabled: !!token })
// TODO: might want to add queryFn to this:
const model: AnalogueModel = useQuery([
'models',
token,
Expand All @@ -75,7 +63,6 @@ export function useAnalogueModels(id?: string) {

return {
model,
fetchModel,
createModel,
models,
uploadNCFile,
Expand Down

0 comments on commit abd307b

Please sign in to comment.