Skip to content

Commit

Permalink
Fix #351Server errors during the PWA generation not handled
Browse files Browse the repository at this point in the history
  • Loading branch information
mleroi committed Jan 16, 2018
1 parent c40d52f commit a2a4a3a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion wp-appkit/lib/apps/apps.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
box-shadow: none;
border-right: 4px solid #fff;
border-left: none;
text-align: right;
}

div.updated.wpak_export_pwa_feedback {
div.updated.wpak_export_pwa_feedback,
div.error.wpak_export_pwa_feedback {
border-left: none;
box-shadow: none;
}
Expand Down
1 change: 1 addition & 0 deletions wp-appkit/lib/apps/apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public static function admin_enqueue_scripts() {
'see_pwa' => __( 'View Progressive Web App', WpAppKit::i18n_domain ),
'pwa_icons_detected' => __( 'We detected the following icons in your theme (in %s). They will be automatically used by the PWA:', WpAppKit::i18n_domain ),
'pwa_no_icons' => __( 'We didn\'t detect any icons in your theme. You can add them in following <a href="#">our tutorial</a>. If you don\'t provide icons, default ones will be used.', WpAppKit::i18n_domain ),
'install_server_error' => __( 'A network or server error occured', WpAppKit::i18n_domain )
)
));
}
Expand Down
13 changes: 11 additions & 2 deletions wp-appkit/lib/apps/pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ jQuery().ready( function () {
'<a href="'+ response.export_uri +'" target="_blank">'+ wpak_pwa_export.messages['see_pwa'] +'</a>'
);
} else {
$feedback.removeClass('updated,error').addClass( 'error' ).html( response.msg );
$feedback.removeClass('updated error').addClass( 'error' ).html( response.msg );
}
} );

}).fail(function() {
$spinner.removeClass( 'is-active' );
$feedback.removeClass('updated error').addClass( 'error' ).html( wpak_pwa_export.messages['install_server_error'] );
});

} );

Expand Down Expand Up @@ -62,7 +66,12 @@ jQuery().ready( function () {
html = $( '<div>' ).addClass( 'wpak-pwa-no-icons' ).html( wpak_pwa_export.messages.pwa_no_icons );
}
$icons_container.html( html );

}).fail(function() {
var html = $( '<div>' ).addClass( 'wpak-pwa-no-icons' ).html( wpak_pwa_export.messages['install_server_error'] );
$icons_container.html( html );
});

}).change();

$( '.color-field' ).wpColorPicker();
Expand Down
2 changes: 1 addition & 1 deletion wp-appkit/wp-appkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class WpAppKit {

const resources_version = '1.0';
const resources_version = '1.5';
const i18n_domain = 'wp-appkit';

public static function hooks() {
Expand Down

0 comments on commit a2a4a3a

Please sign in to comment.