// PHP ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* IMPORTANTE No Quitar este comentario. */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global if( typeof toolbox == 'undefined' ){ var toolbox = {}; } function onSignIn( googleUser ){ toolbox.perfilUsuario = googleUser.getBasicProfile(); // Debug toolbox.debug && console.log( 'toolbox.perfilUsuario', toolbox.perfilUsuario ); // AJAX jQuery.ajax( { url: toolbox.baseURL + '/includes/ajax/verify-id-token-ajax.php', type: 'POST', dataType: 'json', data: { id_token: googleUser.getAuthResponse().id_token } } ) .done( function( response ){ toolbox.debug && console.log( 'onSignIn.response', response ); if( response.error ){ bootbox.dialog( { title: 'Usuario no registrado', message: $( '.templates .non-user-msg' ).html().replace( '{{ user }}', toolbox.perfilUsuario.getEmail() ), className: 'alert info' } ); console.error( 'onSignIn.error', response.error ); return; } location.href = toolbox.baseURL + '/productos.php'; } ); } ( function( $ ){ // Extend toolbox & actions $.extend( toolbox, { baseURL: 'https://members.azbox.shop', debug: true && $( 'body' ).hasClass( 'es-desarrollo' ), ajax: function( data ){ return $.ajax( $.extend( this.ajaxConf, { data: data } ) ); }, ajaxConf: { url: 'https://members.azbox.shop/includes/ajax/azbox-ajax.php', type: 'POST', dataType: 'json' }, actions: new UiActions( { className: 'toolbox-action' } ) } ); } )( jQuery );