Auth Condition
The auth-condition
performs validation that the user is logged in to render different layouts.
Configuration
- Import the
vtex.list
app to your theme's peer dependencies in themanifest.json
file as in the following example:
_10 "peerDependencies": {_10 "vtex.list": "3.x"_10 }
- Add the
auth-condition
block for conditional validation in a template, like the one from home. For example:
_10 "store.home": {_10 "blocks": [_10+ "auth-condition",_10 ]_10 }
- Add the rendering condition you want by passing the blocks via props. For example:
_10"auth-condition": {_10 "props": {_10 "Then": "flex-layout.row#home-with-user",_10 "Else": "flex-layout.row#home-without-user"_10 }_10 }
Props
Prop Name | Type | Description | Default value |
---|---|---|---|
Then | block | Name of the block to be rendered if the conditions are met. | undefined |
Else | block | Name of the block to be rendered if the conditions are not met. | undefined |