修复 api 前缀

This commit is contained in:
whyour 2023-09-29 16:26:03 +08:00
parent 2a41f64d1b
commit 4c19054b30
3 changed files with 9 additions and 7 deletions

View File

@ -178,7 +178,7 @@ export default function () {
useEffect(() => { useEffect(() => {
if (!user || !user.username) return; if (!user || !user.username) return;
const ws = WebSocketManager.getInstance( const ws = WebSocketManager.getInstance(
`${window.location.origin}${window.__ENV__QlBaseUrl || '/'}api/ws?token=${localStorage.getItem( `${window.location.origin}${config.apiPrefix}ws?token=${localStorage.getItem(
config.authKey, config.authKey,
)}`, )}`,
); );
@ -320,7 +320,7 @@ export default function () {
shape="square" shape="square"
size="small" size="small"
icon={<UserOutlined />} icon={<UserOutlined />}
src={user.avatar ? `/api/static/${user.avatar}` : ''} src={user.avatar ? `${config.apiPrefix}static/${user.avatar}` : ''}
/> />
<span style={{ marginLeft: 5 }}>{user.username}</span> <span style={{ marginLeft: 5 }}>{user.username}</span>
</span> </span>
@ -342,7 +342,7 @@ export default function () {
shape="square" shape="square"
size="small" size="small"
icon={<UserOutlined />} icon={<UserOutlined />}
src={user.avatar ? `/api/static/${user.avatar}` : ''} src={user.avatar ? `${config.apiPrefix}static/${user.avatar}` : ''}
/> />
<span style={{ marginLeft: 5 }}>{user.username}</span> <span style={{ marginLeft: 5 }}>{user.username}</span>
</span> </span>

View File

@ -253,7 +253,7 @@ const Other = ({
method="put" method="put"
showUploadList={false} showUploadList={false}
maxCount={1} maxCount={1}
action="/api/system/data/import" action={`${config.apiPrefix}system/data/import`}
onChange={(e) => { onChange={(e) => {
if (e.event?.percent) { if (e.event?.percent) {
showUploadProgress(parseFloat(e.event?.percent.toFixed(1))); showUploadProgress(parseFloat(e.event?.percent.toFixed(1)));

View File

@ -97,14 +97,16 @@ const SecuritySettings = ({ user, userChange }: any) => {
const onChange = (e) => { const onChange = (e) => {
if (e.file && e.file.response) { if (e.file && e.file.response) {
setAvatar(`/api/static/${e.file.response.data}`); setAvatar(
`${config.apiPrefix}static/${e.file.response.data}`,
);
userChange(); userChange();
} }
}; };
useEffect(() => { useEffect(() => {
setTwoFactorActivated(user && user.twoFactorActivated); setTwoFactorActivated(user && user.twoFactorActivated);
setAvatar(user.avatar && `/api/static/${user.avatar}`); setAvatar(user.avatar && `${config.apiPrefix}static/${user.avatar}`);
}, [user]); }, [user]);
return twoFactoring ? ( return twoFactoring ? (
@ -250,7 +252,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
method="put" method="put"
showUploadList={false} showUploadList={false}
maxCount={1} maxCount={1}
action="/api/user/avatar" action={`${config.apiPrefix}user/avatar`}
onChange={onChange} onChange={onChange}
name="avatar" name="avatar"
headers={{ headers={{