Logout User
Logs the current user out of the app.
Description
The logoutUser() action logs the current customer out of the app and clears the authenticated session.
Function Signature
await Superfans.actions.logoutUser();| Parameter | Type | Required | Description |
|---|---|---|---|
| Nil | Nil | Nil | This action does not require any parameter. |
Structure of Response
| Status | Response |
|---|---|
| Success | { "status": "success", "message": "User logged out successfully" } |
| Unexpected Error | { "status": "error", "errorId": 500, "errorHandle": "unknown-error", "message": "Something unexpected happened" } |
Example Usage
await Superfans.actions.logoutUser();Best Practices
- Use this from a logout button on account or profile screens.
- Listen to
Superfans.listeners.onLoginStatusChangedand re-readSuperfans.variables.customerafter logout.
Caveats
- This action ends the current customer session; wishlist and account data will no longer be available until the user logs in again.
- Cart behavior after logout depends on the app configuration.
Updated about 7 hours ago
Did this page help you?