feat: Compare Dashboard API done.
This commit is contained in:
31
src/stores/compare.js
Normal file
31
src/stores/compare.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { defineStore } from "pinia";
|
||||
import apiError from '@/module/apiError.js';
|
||||
|
||||
export default defineStore('compareStore', {
|
||||
state: () => ({
|
||||
allCompareDashboardData: null,
|
||||
}),
|
||||
getters: {
|
||||
compareDashboardData: state => {
|
||||
return state.allCompareDashboardData;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
* Get Performance
|
||||
* @param { array } queryParams
|
||||
*/
|
||||
async getCompare(queryParams) {
|
||||
// encodeURIComponent 函數用於將字串中的特殊字符進行編碼,以確保 URL 的正確性。
|
||||
const queryString = JSON.stringify(queryParams);
|
||||
const api = `/api/compare?datasets=${encodeURIComponent(queryString)}`;
|
||||
|
||||
try {
|
||||
const response = await this.$axios.get(api);
|
||||
this.allCompareDashboardData = response.data;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to load the Compare.');
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -1,7 +1,4 @@
|
||||
import { defineStore } from "pinia";
|
||||
// import moment from "moment";
|
||||
// import { Decimal } from 'decimal.js';
|
||||
// import abbreviateNumber from '@/module/abbreviateNumber.js';
|
||||
import apiError from '@/module/apiError.js';
|
||||
|
||||
export default defineStore('performanceStore', {
|
||||
|
||||
Reference in New Issue
Block a user