feat: add customer login page in SPA

- Created Login/index.tsx with styled form
- Added /auth/customer-login API endpoint (no admin perms required)
- Registered route in Routes.php
- Added /login route in customer-spa App.tsx
- Account page now redirects to SPA login instead of wp-login.php
- Login supports redirect param for post-login navigation
This commit is contained in:
Dwindi Ramadhana
2025-12-31 22:43:13 +07:00
parent 3d7eb5bf48
commit 56042d4b8e
5 changed files with 242 additions and 13 deletions

View File

@@ -65,6 +65,13 @@ class Routes {
'permission_callback' => '__return_true',
] );
// Customer login endpoint (no admin permission required)
register_rest_route( $namespace, '/auth/customer-login', [
'methods' => 'POST',
'callback' => [ AuthController::class, 'customer_login' ],
'permission_callback' => '__return_true',
] );
// Defer to controllers to register their endpoints
CheckoutController::register();
OrdersController::register();