From 30d4488afb893005c96e9b9fc4bbe1e489100b23 Mon Sep 17 00:00:00 2001 From: Andrew Matthews Date: Fri, 15 Oct 2021 16:56:55 -0400 Subject: [PATCH] refactor: REST API namespace wpac -> faustwp --- packages/core/src/server/auth/token.ts | 2 +- packages/core/test/server/auth/middleware.test.ts | 2 +- plugins/wpe-headless/includes/rest/callbacks.php | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/core/src/server/auth/token.ts b/packages/core/src/server/auth/token.ts index ed614ab2a..e7f52f594 100644 --- a/packages/core/src/server/auth/token.ts +++ b/packages/core/src/server/auth/token.ts @@ -61,7 +61,7 @@ export class OAuth { ); } - const response = await fetch(`${wpUrl}/wp-json/wpac/v1/authorize`, { + const response = await fetch(`${wpUrl}/wp-json/faustwp/v1/authorize`, { headers: { 'Content-Type': 'application/json', 'x-wpe-headless-secret': apiClientSecret, diff --git a/packages/core/test/server/auth/middleware.test.ts b/packages/core/test/server/auth/middleware.test.ts index e1e0ce695..ba1ec3b7f 100644 --- a/packages/core/test/server/auth/middleware.test.ts +++ b/packages/core/test/server/auth/middleware.test.ts @@ -104,7 +104,7 @@ describe('auth/middleware', () => { const { wpUrl } = config(); - fetchMock.post(`${wpUrl}/wp-json/wpac/v1/authorize`, { + fetchMock.post(`${wpUrl}/wp-json/faustwp/v1/authorize`, { status: 401, body: JSON.stringify({ error: 'some error' }), }); diff --git a/plugins/wpe-headless/includes/rest/callbacks.php b/plugins/wpe-headless/includes/rest/callbacks.php index 726b6ace2..00af094c4 100644 --- a/plugins/wpe-headless/includes/rest/callbacks.php +++ b/plugins/wpe-headless/includes/rest/callbacks.php @@ -59,9 +59,7 @@ function rest_determine_current_user( $user_id ) { /** * Callback for WordPress 'rest_api_init' action. * - * Register the POST /wpac/v1/authorize endpoint. - * - * @todo Are we keeping the `wpac` namespace? + * Register the POST /faustwp/v1/authorize endpoint. * * @link https://developer.wordpress.org/reference/functions/register_rest_route/ * @link https://developer.wordpress.org/rest-api/extending-the-rest-api/routes-and-endpoints/ @@ -70,7 +68,7 @@ function rest_determine_current_user( $user_id ) { */ function register_rest_routes() { register_rest_route( - 'wpac/v1', + 'faustwp/v1', '/authorize', array( 'methods' => 'POST', @@ -83,7 +81,7 @@ function register_rest_routes() { /** * Callback for WordPress register_rest_route() 'callback' parameter. * - * Handle POST /wpac/v1/authorize response. + * Handle POST /faustwp/v1/authorize response. * * Use the 'code' (authorization code) parameter to generate a new access token. *