-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
staging api fetch helper: append the path after the url returns from runtime #578
Conversation
Release version 3.0.6
Updates for Release 3.0.6
Release 3.0.7
php-7.1, wp-6.11 replays were recorded for 81b5f50. 1 Failed
php-7.1, wp-6.21 replays were recorded for 81b5f50. 1 Failed
php-7.2, wp-6.21 replays were recorded for 81b5f50. 1 Failed
php-7.3, wp-6.12 replays were recorded for 81b5f50. 2 Failed
php-7.3, wp-6.22 replays were recorded for 81b5f50. 2 Failed
php-7.4, wp-6.12 replays were recorded for 81b5f50. 2 Failed
php-7.4, wp-6.22 replays were recorded for 81b5f50. 2 Failed
php-8.0, wp-6.12 replays were recorded for 81b5f50. 2 Failed
php-8.0, wp-6.22 replays were recorded for 81b5f50. 2 Failed
php-8.1, wp-6.12 replays were recorded for 81b5f50. 2 Failed
php-8.1, wp-6.22 replays were recorded for 81b5f50. 2 Failed
php-8.2, wp-6.12 replays were recorded for 81b5f50. 2 Failed
php-8.2, wp-6.22 replays were recorded for 81b5f50. 2 Failed
Main Test Suite2 replays were recorded for 81b5f50. 2 Failed
|
Other option which introduces more change but is also possible, is modifying the signature of const stagingApiFetch = (
{ path = "", qs = {} },
method = "GET",
thenCallback,
errorCallback = catchError
) => {
// setIsError( false );
// setIsLoading( true );
setIsThinking(true);
return apiFetch({
url: NewfoldRuntime.createApiUrl(apiNamespace + path, qs),
method,
// beforeSend: (xhr) => {
// xhr.setRequestHeader( 'X-WP-Nonce', restnonce );
// },
})
.then((response) => {
thenCallback(response);
})
.catch((error) => {
errorCallback(error);
});
}; and then we can use it as stagingApiFetch({ path: `staging/switch-to`, qs: { env } }, "GET", callback); |
Thanks for the suggestion @aulisius - I like this better, I'll get it in place before merging. |
Tweak the way staging rest api urls are passed now that we're using runtime.
In my testing this appears to be all we need to change in order for urls to work properly for switching to/from staging environments. This appends the path to the api url once we get it rather than passing the whole path to the runtime createApiUrl helper.
Proposed changes
Type of Change
Checklist
Further comments