Skip to main content

useSession

useSession

useSession(): ISession

Get information about the current users of the widget.

Notes: Since the datasheet can be share out, the id, name, avatar, ect. of the user information in the case of not logged in is undefined.

Returns

ISession

Example

import { useSession } from '@apitable/widget-sdk';

// Show the currently users name of the widget.
function Meta() {
const session = useSession();
return (<div>
<p>{session.user.name}</p>
</div>);
}