diff --git a/client/index.js b/client/index.js
index 63f7049a..5efc3832 100644
--- a/client/index.js
+++ b/client/index.js
@@ -27,8 +27,7 @@ const show = ( dom ) => {
ReactDOM.render( , document.getElementById( dom ) );
};
-if ( document.querySelector( '#react-ui' ) ) {
+if ( document.querySelector( '#react-ui' ) && Redirectioni10n ) {
show( 'react-ui' );
+ window.redirection = Redirectioni10n.version;
}
-
-window.redirection = Redirectioni10n.version;
diff --git a/client/lib/capabilities/index.js b/client/lib/capabilities/index.js
index 9726e404..ff4216eb 100644
--- a/client/lib/capabilities/index.js
+++ b/client/lib/capabilities/index.js
@@ -1,11 +1,11 @@
/* global Redirectioni10n */
export function has_capability( cap ) {
- return Redirectioni10n.caps.capabilities.indexOf( cap ) !== -1;
+ return Redirectioni10n?.caps?.capabilities.indexOf( cap ) !== -1;
}
export function has_page_access( page ) {
- return Redirectioni10n.caps.pages.indexOf( page ) !== -1;
+ return Redirectioni10n?.caps?.pages.indexOf( page ) !== -1;
}
export const CAP_REDIRECT_MANAGE = 'redirection_cap_redirect_manage';
diff --git a/redirection-admin.php b/redirection-admin.php
index 3639eab2..244c6102 100644
--- a/redirection-admin.php
+++ b/redirection-admin.php
@@ -498,7 +498,7 @@ function showError() {
document.querySelector( '.react-loading' ).style.display = 'none';
document.querySelector( '.react-error' ).style.display = 'block';
- if ( typeof Redirectioni10n !== 'undefined' ) {
+ if ( typeof Redirectioni10n !== 'undefined' && Redirectioni10n ) {
document.querySelector( '.versions' ).innerHTML = Redirectioni10n.versions.replace( /\n/g, '
' );
document.querySelector( '.react-error .button-primary' ).href += '&body=' + encodeURIComponent( errorText ) + encodeURIComponent( Redirectioni10n.versions );
}