useCustomerLogin

A customer hook that helps you easily login an existing customer via email and password.

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

// instantiation
const { customer, customerLogin, ...loginStatus } = useCustomerLogin()

// use
const loggedInCustomer = await customerLogin({
  email,
  password,
})

email

a customer registered email address

password

a valid customer password

The storefront will automatically redirect logged in users to /account

Last updated