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

wrapping homepage content in permission element

This commit is contained in:
Jamie Hewitt 2021-05-20 17:10:05 +03:00
parent 5d311ccb2f
commit f74ec8dce5
3 changed files with 37 additions and 34 deletions

View File

@ -1,10 +1,12 @@
import React, { ReactElement, useEffect, useState } from 'react'
import React, { Children, ReactElement, useEffect, useState } from 'react'
import rbacRequest from '../../utils/rbac'
export default function Permission({
eventType
eventType,
children
}: {
eventType: string
children: ReactElement
}): ReactElement {
const [data, updateData] = useState<boolean>()
useEffect(() => {
@ -16,8 +18,8 @@ export default function Permission({
}, [])
if (data === false) {
return <div>Sorry you do not have permission to {eventType}</div>
return <b>Sorry you do not have permission to {eventType}</b>
} else {
return <div>permission</div>
return <>{children}</>
}
}

View File

@ -95,7 +95,7 @@ function SectionQueryResult({
export default function HomePage(): ReactElement {
return (
<>
<Permission eventType="browse" />
<Permission eventType="browse">
<Container narrow className={styles.searchWrap}>
<SearchBar size="large" />
</Container>
@ -127,6 +127,7 @@ export default function HomePage(): ReactElement {
</Button>
}
/>
</Permission>
</>
)
}

View File

@ -12,7 +12,7 @@ export default async function rbacRequest(eventType: string): Promise<boolean> {
eventType,
credentials: {
token:
'eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJDWVdQTTJLY1NKUjJtV0o2ZFBqZTVKVmZ5YTZnZXdhVElVZDBabUoyWndFIn0.eyJleHAiOjE2MjE1MTE2MTgsImlhdCI6MTYyMTUxMTAxOCwianRpIjoiZWI3YzZjNmYtYjVjYi00YjA0LWI0ZjAtOWMzZTEzOGM3YWViIiwiaXNzIjoiaHR0cHM6Ly9rZXljbG9hay1pbnQuZGF0YS1tYXJrZXRwbGFjZS5pby9hdXRoL3JlYWxtcy9tYXJrZXRwbGFjZSIsImF1ZCI6ImFjY291bnQiLCJzdWIiOiJkZDM2NDVlZi0zN2Q5LTQzMzQtOWEzYy1jMjczNTRkYmNkMWMiLCJ0e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