From 466361fc2f03cfe0a24f99dbf40255ad6c0e2441 Mon Sep 17 00:00:00 2001 From: devanshu052000 Date: Wed, 28 May 2025 13:47:51 +0530 Subject: [PATCH] Added check for running query and error handling for the same --- .../_stores/slices/queryPanelSlice.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/frontend/src/AppBuilder/_stores/slices/queryPanelSlice.js b/frontend/src/AppBuilder/_stores/slices/queryPanelSlice.js index 436e40aa6d..3a6a12dd87 100644 --- a/frontend/src/AppBuilder/_stores/slices/queryPanelSlice.js +++ b/frontend/src/AppBuilder/_stores/slices/queryPanelSlice.js @@ -266,6 +266,28 @@ export const createQueryPanelSlice = (set, get) => ({ let dataQuery = {}; + //for viewer, if query is restricted throw unauthorized error + if (query.restricted) { + setResolvedQuery(queryId, { + isLoading: false, + metadata: { + response: { + statusCode: 401, + responseBody: 'Unauthorized access', + }, + }, + response: { + statusCode: 401, + responseBody: 'Unauthorized access', + }, + }); + onEvent('onDataQueryFailure', queryEvents); + return { + statusCode: 401, + responseBody: 'Unauthorized access', + }; + } + //for viewer we will only get the environment id from the url const { currentAppEnvironmentId, environmentId } = app;