1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

return true if no rbac url env is set

This commit is contained in:
Jamie Hewitt 2021-05-20 16:01:54 +03:00
parent 728c1a503b
commit 3de0179f5d

View File

@ -5,26 +5,32 @@ export async function rbacRequest(
component: string,
eventType: string,
token: string
): Promise<Response> {
const data = {
component,
eventType,
credentials: {
token
): Promise<boolean> {
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)
}
}