To check the current user is a guest user, import the current user’s status from @salesforce/user/isGuest
Syntax
HTML Code
Javascript Controller
Output
Syntax
import isGuestUser from '@salesforce/user/isGuest';
isGuestuser identifier provides the guest user information if it returns true the current is a guest user or if it returns false current user not a guest userHTML Code
<template>
<lightning-card>
<div class="slds-m-around_medium">
<p>Current User is guest or not: <b>{isGuestUser}</b></p>
</div>
</lightning-card>
</template>
Javascript Controller
import { LightningElement } from 'lwc';
import isGuest from '@salesforce/user/isGuest';
export default class currentUserInfo extends LightningElement {
isGuestUser = isGuest;
}
Output
No comments:
Post a Comment