From b67163e8141bb2928bdf88250cce76fdd42b6687 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Mon, 31 Oct 2022 00:51:10 +0100 Subject: [PATCH] Fiks "may be null" --- .../ProcessInputForm/classShowHideElements.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/classes/ProcessInputForm/classShowHideElements.ts b/scripts/classes/ProcessInputForm/classShowHideElements.ts index 255525a..69cebaf 100644 --- a/scripts/classes/ProcessInputForm/classShowHideElements.ts +++ b/scripts/classes/ProcessInputForm/classShowHideElements.ts @@ -6,44 +6,46 @@ export default class classShowHideElements { * Show the loading spinner * @returns void */ - static showLoadingSpinner(): void { - window.document.getElementById("loadingSpinner").classList.remove("d-none"); + static showLoadingSpinner(): void { + window.document + .getElementById("loadingSpinner") + ?.classList.remove("d-none"); } /** * Hide the loading spinner * @returns void */ - static hideLoadingSpinner(): void { - window.document.getElementById("loadingSpinner").classList.add("d-none"); + static hideLoadingSpinner(): void { + window.document.getElementById("loadingSpinner")?.classList.add("d-none"); } /** * Display the table and add animation class * @returns void */ - static showDataTable(): void { - window.document.getElementById("tableElement").classList.remove("d-none"); + static showDataTable(): void { + window.document.getElementById("tableElement")?.classList.remove("d-none"); } /** * Hide the table. Usually caused by an error * @returns void */ - static hideDataTable(): void { + static hideDataTable(): void { window.document .getElementById("tableElement") - .classList.add("animate__fadeOut"); + ?.classList.add("animate__fadeOut"); } /** * Hide loading spinner and data table * @returns void */ - static hideElements(): void { + static hideElements(): void { window.document .getElementById("tableElement") - .classList.add("animate__fadeOut"); - window.document.getElementById("loadingSpinner").classList.add("d-none"); + ?.classList.add("animate__fadeOut"); + window.document.getElementById("loadingSpinner")?.classList.add("d-none"); } }