Ghost/ghost/admin/app/services/upgrade-status.js
Kevin Ansfield 3c92c171f9 "503 Maintenance" error handling
refs https://github.com/TryGhost/Ghost/issues/6976
- adds custom `MaintenanceError` and associated error checking functions
- updates app route and notifications service to handle `503` errors via the `upgrade-status` service
2016-07-08 15:17:26 +01:00

24 lines
729 B
JavaScript

import Service from 'ember-service';
import injectService from 'ember-service/inject';
export default Service.extend({
isRequired: false,
notifications: injectService(),
maintenanceAlert() {
this.get('notifications').showAlert(
'Sorry, Ghost is currently undergoing maintenance, please wait a moment then try again.',
{type: 'error', key: 'api-error.under-maintenance'}
);
},
requireUpgrade() {
this.set('isRequired', true);
this.get('notifications').showAlert(
'Ghost has been upgraded, please copy any unsaved data and refresh the page to continue.',
{type: 'error', key: 'api-error.upgrade-required'}
);
}
});