mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
fix(image Name): switched index of image with Date().getTime()
This commit is contained in:
@@ -143,7 +143,6 @@ 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"}
|
||||||
@@ -153,9 +152,6 @@ export default function ModalModifyImages(props) {
|
|||||||
>
|
>
|
||||||
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