Update image URL logic in ImageUploader component
Replace direct `fileUrl` usage with `getServerFileUrl` utility for consistent server URL formatting. Remove unnecessary fallback logic to streamline image selection.
This commit is contained in:
@@ -7,6 +7,7 @@ import { usePresignedUpload } from "@/hooks/usePresignedUpload";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { Loader2, RefreshCw, Upload, X } from "lucide-react";
|
||||
import { getServerFileUrl } from "@/lib/utils";
|
||||
|
||||
export interface ImageUploaderProps {
|
||||
id: string;
|
||||
@@ -97,10 +98,9 @@ export function ImageUploader({
|
||||
const handleSelectClick = () => {
|
||||
fileInputRef.current?.click();
|
||||
};
|
||||
|
||||
// Determine the current image to display
|
||||
const currentImage = fileUrl || preview || existingImage;
|
||||
|
||||
const currentImage = getServerFileUrl(fileUrl) || preview || existingImage;
|
||||
// const currentImage = preview || existingImage;
|
||||
return (
|
||||
<div className={`w-full space-y-2 ${className}`}>
|
||||
{label && (
|
||||
|
||||
Reference in New Issue
Block a user