mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-05 15:57:23 +01:00
Switch to ES6 modules
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
class Me {
|
||||
export class Me {
|
||||
/* construct with return value from GET /me */
|
||||
constructor(me) {
|
||||
Object.assign(this, me);
|
||||
@@ -18,7 +18,7 @@ class Me {
|
||||
* axios interceptors for authentication
|
||||
*/
|
||||
|
||||
function init_axios_interceptors() {
|
||||
export function init_authentication_interceptors() {
|
||||
|
||||
// requests: attach non-session based auth (admin panel)
|
||||
axios.interceptors.request.use(request => {
|
||||
@@ -38,7 +38,8 @@ function init_axios_interceptors() {
|
||||
});
|
||||
|
||||
|
||||
// reponses: redirect on authorization failure
|
||||
// reponses: handle authorization failures by throwing exceptions
|
||||
// users should catch AuthenticationError exceptions
|
||||
axios.interceptors.response.use(
|
||||
response => {
|
||||
if (response.data &&
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class ValueError extends Error {
|
||||
export class ValueError extends Error {
|
||||
constructor(msg) {
|
||||
super(msg);
|
||||
}
|
||||
};
|
||||
|
||||
class AssertionError extends Error {
|
||||
export class AssertionError extends Error {
|
||||
}
|
||||
|
||||
class AuthenticationError extends Error {
|
||||
export class AuthenticationError extends Error {
|
||||
constructor(caused_by_error, msg, response) {
|
||||
super(msg);
|
||||
this.caused_by = caused_by_error;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Vue.component('spinner', {
|
||||
var spinner = Vue.component('spinner', {
|
||||
template: '<span class="spinner-border spinner-border-sm"></span>'
|
||||
});
|
||||
|
||||
Vue.component('page-header', function(resolve, reject) {
|
||||
var header = Vue.component('page-header', function(resolve, reject) {
|
||||
axios.get('ui-common/page-header.html').then((response) => { resolve({
|
||||
|
||||
props: {
|
||||
@@ -17,3 +17,5 @@ Vue.component('page-header', function(resolve, reject) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
export { spinner, header as default };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Vue.component('page-layout', function(resolve, reject) {
|
||||
export default Vue.component('page-layout', function(resolve, reject) {
|
||||
axios.get('ui-common/page-layout.html').then((response) => { resolve({
|
||||
|
||||
template: response.data,
|
||||
|
||||
Reference in New Issue
Block a user