diff --git a/src/utils/rbac.ts b/src/utils/rbac.ts index 2cc78e460..38c34d6f1 100644 --- a/src/utils/rbac.ts +++ b/src/utils/rbac.ts @@ -5,26 +5,32 @@ export async function rbacRequest( component: string, eventType: string, token: string -): Promise { - const data = { - component, - eventType, - credentials: { - token +): Promise { + const url = appConfig.rbacUrl + if (url === 'false') { + return true + } else { + const data = { + component, + eventType, + credentials: { + token + } + } + console.log('appConfig', appConfig) + console.log('appConfig rbacUrl', appConfig.rbacUrl) + try { + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(data) + }) + + return await response.json() + } catch (error) { + console.error('Error parsing json: ' + error.message) } } - console.log('appConfig', appConfig) - console.log('appConfig rbacUrl', appConfig.rbacUrl) - try { - const response = await fetch('http://localhost:3000', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }) - return await response.json() - } catch (error) { - console.error('Error parsing json: ' + error.message) - } }