Global loading done.

This commit is contained in:
chiayin
2023-02-15 16:26:07 +08:00
parent 79b503bd8a
commit 819199864d
9 changed files with 110 additions and 19 deletions

View File

@@ -1,7 +1,11 @@
import { defineStore } from "pinia";
import loadingStore from './loading.js';
import pinia from '@/stores/main.js'
import axios from "axios";
import moment from 'moment';
const loading = loadingStore(pinia);
export default defineStore('filesStore', {
state: () => ({
allFilter: [
@@ -23,6 +27,7 @@ export default defineStore('filesStore', {
DESIGN: ['Log', 'Design'],
},
filesTag: 'ALL',
httpStatus: 200,
}),
getters: {
/**
@@ -60,8 +65,11 @@ export default defineStore('filesStore', {
o.accessed_at = moment(o.accessed_at).format('YYYY-MM-DD HH:MM');
return this.allEventLog
})
if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
} finally {};
loading.isLoading = true;
this.httpStatus = error.request.status;
};
},
/**
* Fetch filters api
@@ -78,8 +86,11 @@ export default defineStore('filesStore', {
o.updated_at = moment(o.updated_at).format('YYYY-MM-DD HH:MM');
o.accessed_at = moment(o.accessed_at).format('YYYY-MM-DD HH:MM');
});
if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
} finally {};
loading.isLoading = true;
this.httpStatus = error.request.status;
};
},
}
})