useCustomerLogout

A customer hook that helps you easily logout an currently logged in customer

// import
import { useCustomerLogout } from '@backpackjs/storefront';

// instantiation
const { customerLogout, ...logoutStatus  } = useCustomerLogout();

// use
const loggedOut = await customerLogout();

The storefront will automatically redirect logged out users to/accounts/login

Last updated