En-/decryption fixed

This commit is contained in:
Torsten Schulz
2024-07-28 16:12:48 +02:00
parent 4c12303edc
commit 4b6ad3aefe
27 changed files with 3315 additions and 97 deletions

View File

@@ -1,4 +1,5 @@
import axios from 'axios';
import store from '../store';
const apiClient = axios.create({
baseURL: process.env.VUE_APP_API_BASE_URL || 'http://localhost:3001',
@@ -7,4 +8,18 @@ const apiClient = axios.create({
}
});
apiClient.interceptors.request.use(config => {
console.log('loading user');
const user = store.getters.user;
console.log(user);
if (user && user.authCode) {
console.log('set auth');
config.headers['userId'] = user.id;
config.headers['authCode'] = user.authCode;
}
return config;
}, error => {
return Promise.reject(error);
});
export default apiClient;

View File

@@ -1,4 +1,4 @@
import axios from 'axios';
import apiClient from './axios';
import store from '../store';
const loadMenu = async () => {
@@ -7,7 +7,7 @@ const loadMenu = async () => {
if (!userId) {
throw new Error('User ID not found');
}
const response = await axios.get('/api/navigation/' + userId);
const response = await apiClient.get('/api/navigation/' + userId);
return response.data;
} catch (err) {
console.error(err);