refactor: Conformance Router - FILES page to Confomance page router refresh the page done.
This commit is contained in:
@@ -15,6 +15,7 @@ import ConformanceStore from '@/stores/conformance.js';
|
||||
import StatusBar from '@/components/Discover/StatusBar.vue';
|
||||
import ConformanceResults from '@/components/Discover/Conformance/ConformanceResults.vue';
|
||||
import ConformanceSidebar from '@/components/Discover/Conformance/ConformanceSidebar.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
@@ -34,16 +35,8 @@ export default {
|
||||
},
|
||||
async created() {
|
||||
let params = this.$route.params;
|
||||
let parent;
|
||||
let parent = this.$route.meta.parent;
|
||||
|
||||
this.isLoading = true;
|
||||
await this.filesStore.fetchAllFiles();
|
||||
await this.allFiles.forEach(file => {
|
||||
if(file.id == params.fileId) {
|
||||
parent = file.parent;
|
||||
this.conformanceParent = file.parent;
|
||||
}
|
||||
});
|
||||
// type: log | filter | rule(名稱待討論) | log-check(MAP page 來的已存檔 rule) | filter-check(MAP page 來的已存檔 rule)
|
||||
switch (params.type) {
|
||||
case 'log': // FILES page 來的 log
|
||||
@@ -119,5 +112,19 @@ export default {
|
||||
this.conformanceRuleData = null;
|
||||
this.conformanceFileName = null;
|
||||
},
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
const filesStore = FilesStore();
|
||||
// Save token in Headers.
|
||||
const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
||||
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
||||
|
||||
await filesStore.fetchAllFiles();
|
||||
await filesStore.allFiles.forEach(file => {
|
||||
if(file.id == to.params.fileId) {
|
||||
to.meta.parent = file.parent;
|
||||
}
|
||||
});
|
||||
next();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user