refactor (slight, although many files)

This commit is contained in:
Cindy Chang
2024-06-06 09:25:26 +08:00
parent 0df045c218
commit 9539237c3d
8 changed files with 162 additions and 45 deletions

View File

@@ -193,9 +193,12 @@ export default defineStore('conformanceStore', {
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterId !== null) api = `/api/filter-checks/params?filter_id=${filterId}`;
else api = `/api/log-checks/params?log_id=${logId}`;
if(filterId !== null) {
api = `/api/filter-checks/params?filter_id=${filterId}`;
}
else {
api = `/api/log-checks/params?log_id=${logId}`;
}
try {
const response = await this.$axios.get(api);
this.allConformanceTask = response.data.tasks;
@@ -218,13 +221,22 @@ export default defineStore('conformanceStore', {
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterId !== null) api = `/api/temp-filter-checks?filter_id=${filterId}`;
else api = `/api/temp-log-checks?log_id=${logId}`;
if(filterId !== null) {
api = `/api/temp-filter-checks?filter_id=${filterId}`;
}
else {
api = `/api/temp-log-checks?log_id=${logId}`;
}
try {
console.log("addConformanceCheckId() axios data", data)
const response = await this.$axios.post(api, data);
if(filterId !== null) this.conformanceFilterTempCheckId = response.data.id;
else this.conformanceLogTempCheckId = response.data.id;
if(filterId !== null) {
this.conformanceFilterTempCheckId = response.data.id;
}
else {
this.conformanceLogTempCheckId = response.data.id;
}
} catch(error) {
apiError(error, 'Failed to add the Temporary Check for a file.');
}

View File

@@ -0,0 +1,25 @@
import { defineStore } from "pinia";
export default defineStore('conformanceDataStore', {
state: () => ({
dataToSave: {
start: null,
end: null,
min: null,
max: null,
type: null,
task: null,
},
}),
getters: {
},
actions: {
/**
* Set conformance input data which are fed to backend later.
* @param {object} userInputObj
*/
setConformanceData(userInputObj){
this.dataToSave = {...userInputObj};
},
},
})

View File

@@ -37,7 +37,7 @@ export default defineStore('pageAdminStore', {
},
/**
* Specify previous page state value.
* @param {*} prevPage
* @param {string} prevPage
*/
setPrevioiusPage(prevPage) {
// console.log('setPrevioiusPage()', prevPage);