Global loading done.
This commit is contained in:
@@ -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;
|
||||
};
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
7
src/stores/loading.js
Normal file
7
src/stores/loading.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export default defineStore('loadingStore', {
|
||||
state: () => ({
|
||||
isLoading: true,
|
||||
})
|
||||
});
|
||||
3
src/stores/main.js
Normal file
3
src/stores/main.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createPinia } from 'pinia';
|
||||
const pinia = createPinia();
|
||||
export default pinia;
|
||||
Reference in New Issue
Block a user