mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
Create service functions for query permissions
This commit is contained in:
parent
a0eb1956e2
commit
dc0d46cd7b
1 changed files with 42 additions and 0 deletions
|
|
@ -7,6 +7,10 @@ export const appPermissionService = {
|
|||
createPagePermission,
|
||||
updatePagePermission,
|
||||
deletePagePermission,
|
||||
getQueryPermission,
|
||||
createQueryPermission,
|
||||
updateQueryPermission,
|
||||
deleteQueryPermission,
|
||||
};
|
||||
|
||||
function getPagePermission(appId, pageId) {
|
||||
|
|
@ -47,3 +51,41 @@ function deletePagePermission(appId, pageId) {
|
|||
};
|
||||
return fetch(`${config.apiUrl}/app-permissions/${appId}/pages/${pageId}`, requestOptions).then(handleResponse);
|
||||
}
|
||||
|
||||
function getQueryPermission(appId, queryId) {
|
||||
const requestOptions = {
|
||||
method: 'GET',
|
||||
headers: authHeader(),
|
||||
credentials: 'include',
|
||||
};
|
||||
return fetch(`${config.apiUrl}/app-permissions/${appId}/queries/${queryId}`, requestOptions).then(handleResponse);
|
||||
}
|
||||
|
||||
function createQueryPermission(appId, queryId, body) {
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: authHeader(),
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(body),
|
||||
};
|
||||
return fetch(`${config.apiUrl}/app-permissions/${appId}/queries/${queryId}`, requestOptions).then(handleResponse);
|
||||
}
|
||||
|
||||
function updateQueryPermission(appId, queryId, body) {
|
||||
const requestOptions = {
|
||||
method: 'PUT',
|
||||
headers: authHeader(),
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(body),
|
||||
};
|
||||
return fetch(`${config.apiUrl}/app-permissions/${appId}/queries/${queryId}`, requestOptions).then(handleResponse);
|
||||
}
|
||||
|
||||
function deleteQueryPermission(appId, queryId) {
|
||||
const requestOptions = {
|
||||
method: 'DELETE',
|
||||
headers: authHeader(),
|
||||
credentials: 'include',
|
||||
};
|
||||
return fetch(`${config.apiUrl}/app-permissions/${appId}/queries/${queryId}`, requestOptions).then(handleResponse);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue