Add centralized API client with axios interceptors, remove vue-axios
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,13 +9,11 @@
|
||||
</template>
|
||||
<script>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import axios from 'axios';
|
||||
import LoadingStore from '@/stores/loading.js';
|
||||
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 { getCookie } from "@/utils/cookieUtil.js";
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
@@ -99,10 +97,6 @@ export default {
|
||||
// ([^;]*):捕獲 "luciaToken" 的值,直到遇到下一個分號或字符串結尾。
|
||||
// .*$:匹配剩餘的字符,確保完整的提取。
|
||||
// |^.*$:在找不到 "luciaToken" 的情況下,匹配整個字符串。
|
||||
// 實際應用
|
||||
const token = getCookie('luciaToken');
|
||||
|
||||
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
||||
switch (to.params.type) {
|
||||
case 'log':
|
||||
conformanceStore.setConformanceLogCreateCheckId(to.params.fileId);
|
||||
|
||||
@@ -64,8 +64,6 @@
|
||||
import { onBeforeMount, computed, } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useRoute } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { getCookie } from "@/utils/cookieUtil.js";
|
||||
import LoadingStore from '@/stores/loading.js';
|
||||
import AllMapDataStore from '@/stores/allMapData.js';
|
||||
import ConformanceStore from '@/stores/conformance.js';
|
||||
@@ -537,10 +535,6 @@ export default {
|
||||
|
||||
if (isCheckPage) {
|
||||
const conformanceStore = ConformanceStore();
|
||||
// Save token in Headers.
|
||||
const token = getCookie('luciaToken');
|
||||
|
||||
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
||||
switch (to.params.type) {
|
||||
case 'log':
|
||||
conformanceStore.conformanceLogCreateCheckId = to.params.fileId;
|
||||
|
||||
@@ -137,7 +137,6 @@
|
||||
</template>
|
||||
<script>
|
||||
import { storeToRefs, mapActions, } from 'pinia';
|
||||
import axios from 'axios';
|
||||
import moment from 'moment';
|
||||
import LoadingStore from '@/stores/loading.js';
|
||||
import PerformanceStore from '@/stores/performance.js';
|
||||
@@ -152,7 +151,6 @@ import { simpleTimeLabel, followTimeLabel,
|
||||
} from '@/module/timeLabel.js';
|
||||
import FreqChart from './FreqChart.vue';
|
||||
import { PRIME_VUE_TICKS_LIMIT } from '../../../constants/constants.js';
|
||||
import { getCookie } from "@/utils/cookieUtil.js";
|
||||
|
||||
const primeVueTicksLimit = PRIME_VUE_TICKS_LIMIT;
|
||||
|
||||
@@ -921,10 +919,6 @@ export default {
|
||||
|
||||
if (isCheckPage) {
|
||||
const conformanceStore = ConformanceStore();
|
||||
// Save token in Headers.
|
||||
const token = getCookie('luciaToken');
|
||||
|
||||
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
||||
switch (to.params.type) {
|
||||
case 'log':
|
||||
conformanceStore.conformanceLogCreateCheckId = to.params.fileId;
|
||||
|
||||
Reference in New Issue
Block a user