From ab3cc5fa7067fb1d54e6e2d38b355a84868090d1 Mon Sep 17 00:00:00 2001 From: Kitteh Date: Sat, 8 May 2021 01:57:08 +0100 Subject: [PATCH] Add typing to SetVaultURL.ts. --- src/allPages.ts | 2 +- src/pages/{SetVaultURL.js => SetVaultURL.ts} | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) rename src/pages/{SetVaultURL.js => SetVaultURL.ts} (84%) diff --git a/src/allPages.ts b/src/allPages.ts index f17cb40..39ffc4f 100644 --- a/src/allPages.ts +++ b/src/allPages.ts @@ -11,7 +11,7 @@ import { NewTOTPPage } from "./pages/TOTP/NewTOTP.js"; import { Page } from "./types/Page"; import { PwGenPage } from "./pages/PwGen"; import { SetLanguagePage } from "./pages/SetLanguage"; -import { SetVaultURLPage } from "./pages/SetVaultURL.js"; +import { SetVaultURLPage } from "./pages/SetVaultURL"; import { TOTPViewPage } from "./pages/TOTP/TOTPView.js"; import { TransitDecryptPage } from "./pages/Transit/TransitDecrypt.js"; import { TransitEncryptPage } from "./pages/Transit/TransitEncrypt.js"; diff --git a/src/pages/SetVaultURL.js b/src/pages/SetVaultURL.ts similarity index 84% rename from src/pages/SetVaultURL.js rename to src/pages/SetVaultURL.ts index 4ed1b94..1ab06b3 100644 --- a/src/pages/SetVaultURL.js +++ b/src/pages/SetVaultURL.ts @@ -1,13 +1,13 @@ import { Page } from "../types/Page"; import { changePage, setPageContent } from "../pageUtils"; import { makeElement } from "../htmlUtils"; -import { pageState } from "../globalPageState.ts"; +import { pageState } from "../globalPageState"; export class SetVaultURLPage extends Page { constructor() { super(); } - render() { + render(): void { setPageContent(makeElement({ tag: "form", id: "setVaultURLForm", @@ -43,12 +43,12 @@ export class SetVaultURLPage extends Page { })); document.getElementById("setVaultURLForm").addEventListener("submit", function (e) { e.preventDefault(); - let formData = new FormData(document.querySelector('#setVaultURLForm')); - pageState.apiURL = formData.get("vaultURL"); + const formData = new FormData(document.querySelector('#setVaultURLForm')); + pageState.apiURL = formData.get("vaultURL") as string; changePage("HOME"); }); } - get name() { + get name(): string { return "Set Vault URL"; } }