Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/taskpane/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export const useModels = (projectId: string) => useApiQuery<Model[]>({

export const useModelFilters = (projectId: string, modelId: string, isEnabled: boolean) => useApiQuery<string[]>({
queryKey: ['modelFilters', projectId, modelId],
queryUrl: `projects/${projectId}/models/${modelId}/external-query-available-data`,
queryUrl: `projects/${projectId}/models/${modelId}/products/available-data`,
errorType: PluginErrors.LoadPropertiesFailed,
isEnabled: !!projectId && !!modelId && isEnabled,
formatJson: (response) => response.fields
})

export const useModelData = (projectId: string, modelId: string, includeFields: string[], includeFilters: Record<string, string>, isEnabled: boolean) => {
const queryUrl = `projects/${projectId}/models/${modelId}/external-query${getModelQuery(includeFields, includeFilters)}`;
const queryUrl = `projects/${projectId}/models/${modelId}/products${getModelQuery(includeFields, includeFilters)}`;

return useApiQuery<ModelData>({
queryKey: ['modelData', queryUrl],
Expand All @@ -50,7 +50,7 @@ export const useSaveModelDataMutation = (projectId: string, modelId: string) =>
const sessionId = getSession(modelId)?.sessionId

return useApiMutation<ModelModifications, ModelModificationErrors>({
mutationUrl: `projects/${projectId}/models/${modelId}/external-data-modification`,
mutationUrl: `projects/${projectId}/models/${modelId}/products`,
onError: (response, error) => {
if (response && response.status === 403) updateWorksheetState({currentStep: Steps.EDITING_ACCESS_DENIED});
else updateWorksheetState({error: new PluginError(PluginErrors.SaveDataFailed, error.message)});
Expand Down Expand Up @@ -183,4 +183,4 @@ export const useApiMutation = <InputType, ResponseType>({
}
}
});
};
};