merge upstream

Signed-off-by: wozulong <>
This commit is contained in:
wozulong
2024-07-22 10:51:49 +08:00
11 changed files with 128 additions and 30 deletions

View File

@@ -1,10 +1,13 @@
import { showError } from './utils';
import { getUserIdFromLocalStorage, showError } from './utils';
import axios from 'axios';
export const API = axios.create({
baseURL: import.meta.env.VITE_REACT_APP_SERVER_URL
? import.meta.env.VITE_REACT_APP_SERVER_URL
: '',
headers: {
'New-API-User': getUserIdFromLocalStorage(),
},
});
API.interceptors.response.use(

View File

@@ -33,6 +33,13 @@ export function getLogo() {
return logo;
}
export function getUserIdFromLocalStorage() {
let user = localStorage.getItem('user');
if (!user) return -1;
user = JSON.parse(user);
return user.id;
}
export function getFooterHTML() {
return localStorage.getItem('footer_html');
}