You are reading the documentation for SDK v2, which is no longer the latest version. Switch to current
isLoggedIn
Method for checking if the user is logged in.
This method sends a POST request to the isLoggedIn endpoint. Method verifies if the user is logged in by checking if the vsf-commercetools-token cookie is set.
Signature
export declare function isLoggedIn(
options?: MethodBaseOptions
): Promise<IsLoggedInResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
options | Optional | MethodBaseOptions | Method options |
Returns
Returns a representation of the IsLoggedInResponse.
Referenced Types
Examples
Check if the user is logged in:
import { sdk } from '~/sdk.config.ts';
const { value } = await sdk.commerce.isLoggedIn();
if (value) {
// User is logged in
}