Skip to content

Commit

Permalink
Reset file from trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Jul 22, 2024
1 parent 2c677a3 commit d34ff98
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useConnection } from '@automattic/jetpack-connection';
import { getSiteData } from '@automattic/jetpack-initial-state';
import {
getMyJetpackWindowInitialState,
getMyJetpackWindowRestState,
getMyJetpackWindowConnectionState,
} from '../../data/utils/get-my-jetpack-window-state';
/**
Expand All @@ -24,18 +24,17 @@ interface MyJetpackConnection {
}

const useMyJetpackConnection = (): MyJetpackConnection => {
const { rest_root, rest_nonce } = getSiteData();

const { apiRoot, apiNonce } = getMyJetpackWindowRestState();
const { topJetpackMenuItemUrl, blogID } = getMyJetpackWindowInitialState();
const connectionData = useConnection( { apiRoot: rest_root, apiNonce: rest_nonce } );
const connectionData = useConnection( { apiRoot, apiNonce } );
const { registrationNonce } = getMyJetpackWindowConnectionState();

// Alias: https://github.com/Automattic/jetpack/blob/trunk/projects/packages/connection/src/class-rest-connector.php/#L315
const isSiteConnected = connectionData.isRegistered;

return {
apiNonce: rest_nonce,
apiRoot: rest_root,
apiNonce,
apiRoot,
blogID,
registrationNonce,
...connectionData,
Expand Down

0 comments on commit d34ff98

Please sign in to comment.