mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-11 17:56:37 +08:00
fix(frontend): keep browser API on same-origin rewrites in dev
Document that NEXT_PUBLIC_WAVELET_BACKEND_URL must stay unset for local next dev so axios hits /api/* and Next rewrites proxy to the backend.
This commit is contained in:
@@ -5,6 +5,7 @@ import { ImageOff } from 'lucide-react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { getFileUrl, type ImageQuality } from '@/lib/services/upload/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
type FileImagePreviewProps = {
|
||||
fileId: string | number;
|
||||
@@ -25,6 +26,7 @@ export function FileImagePreview({
|
||||
}: FileImagePreviewProps) {
|
||||
const [failed, setFailed] = React.useState(false);
|
||||
const src = getFileUrl(fileId, quality);
|
||||
const t = useTranslations('common');
|
||||
|
||||
React.useEffect(() => {
|
||||
setFailed(false);
|
||||
@@ -34,7 +36,7 @@ export function FileImagePreview({
|
||||
return (
|
||||
<div
|
||||
role='img'
|
||||
aria-label={`${alt} 加载失败`}
|
||||
aria-label={`${alt} ${t('loadFailed')}`}
|
||||
className={cn(
|
||||
'flex size-full flex-col items-center justify-center gap-1 bg-muted/50 text-muted-foreground',
|
||||
fallbackClassName,
|
||||
@@ -47,7 +49,7 @@ export function FileImagePreview({
|
||||
)}
|
||||
/>
|
||||
{variant === 'default' && (
|
||||
<span className='text-[10px] leading-none'>加载失败</span>
|
||||
<span className='text-[10px] leading-none'>{t('loadFailed')}</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user