fix: disallow navigation to and blocking of anonymous customers
This commit is contained in:
parent
830997bce2
commit
4116069bd5
4 changed files with 31 additions and 21 deletions
|
|
@ -27,6 +27,7 @@ import {
|
|||
import { getFormattedPhone, getName } from './helper'
|
||||
|
||||
const useStyles = makeStyles(styles)
|
||||
const ANONYMOUS_USER_NAME = 'anonymous'
|
||||
|
||||
const GET_CUSTOMER = gql`
|
||||
query customer($customerId: ID!) {
|
||||
|
|
@ -37,6 +38,7 @@ const GET_CUSTOMER = gql`
|
|||
frontCameraPath
|
||||
frontCameraOverride
|
||||
phone
|
||||
name
|
||||
smsOverride
|
||||
idCardData
|
||||
idCardDataOverride
|
||||
|
|
@ -165,22 +167,26 @@ const CustomerProfile = memo(() => {
|
|||
locale={locale}
|
||||
setShowCompliance={() => setShowCompliance(!showCompliance)}
|
||||
/>
|
||||
<div>
|
||||
<Label1 className={classes.actionLabel}>Actions</Label1>
|
||||
<ActionButton
|
||||
color="primary"
|
||||
Icon={blocked ? AuthorizeIcon : BlockIcon}
|
||||
InverseIcon={blocked ? AuthorizeReversedIcon : BlockReversedIcon}
|
||||
onClick={() =>
|
||||
updateCustomer({
|
||||
authorizedOverride: blocked
|
||||
? OVERRIDE_AUTHORIZED
|
||||
: OVERRIDE_REJECTED
|
||||
})
|
||||
}>
|
||||
{`${blocked ? 'Authorize' : 'Block'} customer`}
|
||||
</ActionButton>
|
||||
</div>
|
||||
{!loading && customerData.name !== ANONYMOUS_USER_NAME && (
|
||||
<div>
|
||||
<Label1 className={classes.actionLabel}>Actions</Label1>
|
||||
<ActionButton
|
||||
color="primary"
|
||||
Icon={blocked ? AuthorizeIcon : BlockIcon}
|
||||
InverseIcon={
|
||||
blocked ? AuthorizeReversedIcon : BlockReversedIcon
|
||||
}
|
||||
onClick={() =>
|
||||
updateCustomer({
|
||||
authorizedOverride: blocked
|
||||
? OVERRIDE_AUTHORIZED
|
||||
: OVERRIDE_REJECTED
|
||||
})
|
||||
}>
|
||||
{`${blocked ? 'Authorize' : 'Block'} customer`}
|
||||
</ActionButton>
|
||||
</div>
|
||||
)}
|
||||
</Box>
|
||||
</div>
|
||||
{!showCompliance && (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue