Skip to content

Commit

Permalink
refactor: REST API namespace wpac -> faustwp
Browse files Browse the repository at this point in the history
  • Loading branch information
apmatthews committed Oct 15, 2021
1 parent 3f860a0 commit 30d4488
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/server/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/server/auth/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }),
});
Expand Down
8 changes: 3 additions & 5 deletions plugins/wpe-headless/includes/rest/callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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',
Expand All @@ -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.
*
Expand Down

0 comments on commit 30d4488

Please sign in to comment.