Skip to content

Commit e58469e

Browse files
committed
checking jetpack connection by api
1 parent 75fb1e3 commit e58469e

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '2ef966c03a0404395d67');
1+
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '396767b273542e5a63e3');

build/performance/performance.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sections/JetpackBoost/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ const JetpackBoost = () => {
128128

129129
const handleRegenerateClick = async () => {
130130
setCssIsGenerating( true );
131+
132+
const response = await apiFetch( {
133+
url: NewfoldRuntime.createApiUrl(
134+
'/jetpack-boost/v1/connection'
135+
),
136+
method: 'GET',
137+
} );
138+
139+
if ( ! response?.connected ) {
140+
await apiFetch( {
141+
url: NewfoldRuntime.createApiUrl(
142+
'/jetpack-boost/v1/connection'
143+
),
144+
method: 'POST',
145+
} );
146+
}
131147
let iframe;
132148
try {
133149
await new Promise( ( resolve ) => setTimeout( resolve, 1000 ) );

0 commit comments

Comments
 (0)