web: fix error due to changed file picker return

This commit is contained in:
Abdullah Atta
2024-03-04 11:03:56 +05:00
parent 3e42d3020d
commit 54debb035a
3 changed files with 5 additions and 5 deletions

View File

@@ -138,7 +138,7 @@ export async function createBackup() {
}
export async function selectBackupFile() {
const file = await showFilePicker({
const [file] = await showFilePicker({
acceptedFileTypes: ".nnbackup,.nnbackupz"
});
if (!file) return;

View File

@@ -64,8 +64,8 @@ export default function EditProfilePictureDialog(
.getImageScaledToCanvas()
.toDataURL("image/jpeg", 0.8)
: clearProfilePicture
? undefined
: profile?.profilePicture;
? undefined
: profile?.profilePicture;
await db.user.setProfile({
profilePicture: pic
});
@@ -124,7 +124,7 @@ export default function EditProfilePictureDialog(
sx={{ flex: 1 }}
variant="secondary"
onClick={async () => {
const file = await showFilePicker({
const [file] = await showFilePicker({
acceptedFileTypes: "image/*"
});
if (!file) return;

View File

@@ -33,7 +33,7 @@ export function showFilePicker({
input.setAttribute("accept", acceptedFileTypes);
input.dispatchEvent(new MouseEvent("click"));
input.oncancel = async function () {
resolve(undefined);
resolve([]);
};
input.onchange = async function () {
if (!input.files) return resolve([]);