mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 16:40:58 -05:00
fix: correctly pass-through preview URLs
This commit is contained in:
parent
0ec7e5e116
commit
aad9a30266
1 changed files with 5 additions and 3 deletions
|
@ -120,7 +120,9 @@ export function FileUploader(props: Props) {
|
||||||
|
|
||||||
const [uploading, setUploading] = useState(false);
|
const [uploading, setUploading] = useState(false);
|
||||||
const [previewFile, setPreviewFile] = useState<File>(null!);
|
const [previewFile, setPreviewFile] = useState<File>(null!);
|
||||||
const [generatedPreviewURL, setGeneratedPreviewURL] = useState("");
|
const [generatedPreviewURL, setGeneratedPreviewURL] = useState<
|
||||||
|
string | undefined
|
||||||
|
>(undefined);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (previewFile) {
|
if (previewFile) {
|
||||||
const url: string = URL.createObjectURL(previewFile);
|
const url: string = URL.createObjectURL(previewFile);
|
||||||
|
@ -291,8 +293,8 @@ export function FileUploader(props: Props) {
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
style === "icon"
|
style === "icon"
|
||||||
? `url('${
|
? `url('${
|
||||||
generatedPreviewURL ??
|
generatedPreviewURL ||
|
||||||
previewURL ??
|
previewURL ||
|
||||||
defaultPreview
|
defaultPreview
|
||||||
}')`
|
}')`
|
||||||
: previewURL
|
: previewURL
|
||||||
|
|
Loading…
Reference in a new issue