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:
parent
728c1a503b
commit
3de0179f5d
@ -5,26 +5,32 @@ export async function rbacRequest(
|
|||||||
component: string,
|
component: string,
|
||||||
eventType: string,
|
eventType: string,
|
||||||
token: string
|
token: string
|
||||||
): Promise<Response> {
|
): Promise<boolean> {
|
||||||
const data = {
|
const url = appConfig.rbacUrl
|
||||||
component,
|
if (url === 'false') {
|
||||||
eventType,
|
return true
|
||||||
credentials: {
|
} else {
|
||||||
token
|
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user