Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 772 Bytes

onlogout-server-action.md

File metadata and controls

26 lines (16 loc) · 772 Bytes

onLogout Server Action

The onLogout function performs a server action to log out a authenticated user. It is part of the @faustwp/experimental-app-router package.

Usage

Here is an example action to log out an existing user that had previously been authenticated:

'use client'
import { onLogout } from '@faustwp/experimental-app-router';

<form action={onLogout}>
  <button type="submit">Logout</button>
</form>;

Technical Reference

onLogout() This function does not accept any arguments.

If the form submission is successful, the server will remove the session cookie that is used to maintain the authentication status.

Additional Context