Skip to content

Commit 7c9c5e3

Browse files
committed
Fix API path and key normalization in dashboard
1 parent 6538c7e commit 7c9c5e3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

projects/packages/forms/src/dashboard/class-dashboard.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ public function load_admin_scripts() {
118118
// Normalize keys to match what apiFetch will request (without domain).
119119
$preload_data = array();
120120
foreach ( $preload_data_raw as $key => $value ) {
121-
$normalized_key = preg_replace( '#^https?://[^/]+/wp-json#', '', $key );
122-
$preload_data[ $normalized_key ] = $value;
123-
$preload_data[ ltrim( $normalized_key, '/' ) ] = $value;
121+
$normalized_key = preg_replace( '#^https?://[^/]+/wp-json#', '', $key );
122+
$preload_data[ $normalized_key ] = $value;
124123
}
125124

126125
wp_add_inline_script(

projects/packages/forms/src/dashboard/store/resolvers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const getFilters =
66
() =>
77
async ( { dispatch } ) => {
88
const results = await apiFetch( {
9-
path: 'wp/v2/feedback/filters',
9+
path: '/wp/v2/feedback/filters',
1010
} );
1111
dispatch.receiveFilters( results );
1212
};

0 commit comments

Comments
 (0)