// PHP ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* IMPORTANTE No Quitar este comentario. */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global if( typeof toolbox == 'undefined' ){ var toolbox = {}; } function onSignIn( googleUser ){ jQuery('.g-signin2').hide(); jQuery('.loading').show(); 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-app.php', type: 'POST', dataType: 'json', data: { id_token: googleUser.getAuthResponse().id_token } } ) .done( function( response ){ jQuery('.g-signin2').show(); jQuery('.loading').hide(); toolbox.debug && console.log( 'onSignIn.response', response ); if( response.error ){ bootbox.dialog( { title: 'Error', message: $( '.templates .non-user-msg' ).html().replace( '{{ user }}', toolbox.perfilUsuario.getEmail() ), className: 'alert warning' } ); console.error( 'onSignIn.error', response.error ); return; } if($('#product_code')){ var url_product = $('#url_product').val(); jQuery.ajax( { url: toolbox.baseURL + '/ext/guardar-datos.php', type: 'POST', dataType: 'json', data: { usuario: { email: toolbox.perfilUsuario.getEmail(), id: toolbox.perfilUsuario.getId() }, url: url_product, source_code: '' } } ) .done( function( response ){ //console.log(response); location.href = toolbox.baseURL + '/productos.php'; } ); }else{ 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 );