sonar 4 left. cookie regex

This commit is contained in:
Cindy Chang
2024-08-13 13:37:11 +08:00
parent 471d8273c1
commit db8f8eefd6
4 changed files with 8 additions and 5 deletions

View File

@@ -57,6 +57,7 @@ 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';
@@ -468,7 +469,7 @@ export default {
if (isCheckPage) {
const conformanceStore = ConformanceStore();
// Save token in Headers.
const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*=\s*([^;]*).*$)|^.*$/, "$1");
const token = getCookie('luciaToken');
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
switch (to.params.type) {