mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-07-09 15:08:06 +00:00
fix(image Name): switched index of image with Date().getTime()
This commit is contained in:
@@ -143,19 +143,15 @@ export default function ModalModifyImages(props) {
|
|||||||
<GridItem key={index}>
|
<GridItem key={index}>
|
||||||
<Flex direction={"column"} gap={"1rem"}>
|
<Flex direction={"column"} gap={"1rem"}>
|
||||||
<Image src={image} />
|
<Image src={image} />
|
||||||
{index === listImage.length - 1 ? (
|
<Button
|
||||||
<Button
|
id={"" + index}
|
||||||
id={"" + index}
|
colorScheme={"red"}
|
||||||
colorScheme={"red"}
|
onClick={(e) => {
|
||||||
onClick={(e) => {
|
deleteImage(`${listImage[index]}`);
|
||||||
deleteImage(`${listImage[index]}`);
|
}}
|
||||||
}}
|
>
|
||||||
>
|
Supprimer l'image
|
||||||
Supprimer l'image
|
</Button>
|
||||||
</Button>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
))}
|
))}
|
||||||
@@ -166,11 +162,14 @@ export default function ModalModifyImages(props) {
|
|||||||
height={"100%"}
|
height={"100%"}
|
||||||
accept={"image/png, image/jpeg, image/webp"}
|
accept={"image/png, image/jpeg, image/webp"}
|
||||||
onInput={({ target }) => {
|
onInput={({ target }) => {
|
||||||
|
const date = new Date();
|
||||||
|
const time = date.getTime();
|
||||||
|
|
||||||
const file = target.files[0];
|
const file = target.files[0];
|
||||||
const extension = file.name.split(".").pop();
|
const extension = file.name.split(".").pop();
|
||||||
const newFile = new File(
|
const newFile = new File(
|
||||||
[file],
|
[file],
|
||||||
`${user.id}_${listImage.length}.${extension}`,
|
`${user.id}_${time}.${extension}`,
|
||||||
{
|
{
|
||||||
type: file.type,
|
type: file.type,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user