Updated the Group creation modal to use Excel

This commit is contained in:
Tiago Ribeiro
2024-01-15 21:32:54 +00:00
parent 2bad3ad09f
commit c68e206aae
2 changed files with 49 additions and 31 deletions

View File

@@ -38,7 +38,7 @@ export default function BatchCodeGenerator({user}: {user: User}) {
const {users} = useUsers();
const {openFilePicker, filesContent} = useFilePicker({
const {openFilePicker, filesContent, clear} = useFilePicker({
accept: ".xlsx",
multiple: false,
readAs: "ArrayBuffer",
@@ -74,10 +74,12 @@ export default function BatchCodeGenerator({user}: {user: User}) {
(x) => x.email,
);
if (information.length === 0)
return toast.error(
if (information.length === 0) {
toast.error(
"Please upload an Excel file containing user information, one per line! All already registered e-mails have also been ignored!",
);
return clear();
}
setInfos(information);
});