En-/decryption fixed
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user