Tidy up the full frontend codebase and use optional chaining where possible (#620)

* Tidy up the full frontend codebase and use optional chaining where possible

* Code review changes
This commit is contained in:
Keavon Chambers
2022-04-30 02:52:53 -07:00
parent d1c32ad7d0
commit 8c9caf12c7
28 changed files with 640 additions and 622 deletions
+6 -5
View File
@@ -21,12 +21,13 @@ export async function upload(acceptedEextensions: string): Promise<{ filename: s
element.addEventListener(
"change",
async () => {
if (!element.files || !element.files.length) return;
const file = element.files[0];
const filename = file.name;
const content = await file.text();
if (element.files?.length) {
const file = element.files[0];
const filename = file.name;
const content = await file.text();
resolve({ filename, content });
resolve({ filename, content });
}
},
{ capture: false, once: true }
);