Skip to content

Commit

Permalink
Supply frontend with endpoints and nonce
Browse files Browse the repository at this point in the history
The UI needs to fetch the scores for SEO and readability
And those routes are protected by a nonce we need to provide
TODO: refactor to onion architecture
  • Loading branch information
igorschoester committed Nov 21, 2024
1 parent b2816f3 commit 3090a21
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public function get_configuration(): array {
Keyphrase_Analysis::NAME,
]
)->to_array(),
'endpoints' => [
'seoScores' => \rest_url( \Yoast\WP\SEO\Main::API_V1_NAMESPACE . \Yoast\WP\SEO\Dashboard\User_Interface\Scores\SEO_Scores_Route::ROUTE_PREFIX ),

Check failure on line 86 in src/dashboard/application/configuration/dashboard-configuration.php

View workflow job for this annotation

GitHub Actions / Check code style

Class \Yoast\WP\SEO\Main should not be referenced via a fully qualified name, but via a use statement.

Check failure on line 86 in src/dashboard/application/configuration/dashboard-configuration.php

View workflow job for this annotation

GitHub Actions / Check code style

Class \Yoast\WP\SEO\Dashboard\User_Interface\Scores\SEO_Scores_Route should not be referenced via a fully qualified name, but via a use statement.
'readabilityScores' => \rest_url( \Yoast\WP\SEO\Main::API_V1_NAMESPACE . \Yoast\WP\SEO\Dashboard\User_Interface\Scores\Readability_Scores_Route::ROUTE_PREFIX ),

Check failure on line 87 in src/dashboard/application/configuration/dashboard-configuration.php

View workflow job for this annotation

GitHub Actions / Check code style

Class \Yoast\WP\SEO\Main should not be referenced via a fully qualified name, but via a use statement.

Check failure on line 87 in src/dashboard/application/configuration/dashboard-configuration.php

View workflow job for this annotation

GitHub Actions / Check code style

Class \Yoast\WP\SEO\Dashboard\User_Interface\Scores\Readability_Scores_Route should not be referenced via a fully qualified name, but via a use statement.
],
'nonce' => \wp_create_nonce( 'wp_rest' ),
];
}
}

0 comments on commit 3090a21

Please sign in to comment.