Add typing to SetVaultURL.ts.
This commit is contained in:
parent
57a0ab5abe
commit
f1ba0a06ce
|
@ -10,7 +10,7 @@ import { MePage } from "./pages/Me";
|
|||
import { NewTOTPPage } from "./pages/TOTP/NewTOTP.js";
|
||||
import { Page } from "./types/Page";
|
||||
import { PwGenPage } from "./pages/PwGen";
|
||||
import { SetLanguagePage } from "./pages/SetLanguage.js";
|
||||
import { SetLanguagePage } from "./pages/SetLanguage";
|
||||
import { SetVaultURLPage } from "./pages/SetVaultURL.js";
|
||||
import { TOTPViewPage } from "./pages/TOTP/TOTPView.js";
|
||||
import { TransitDecryptPage } from "./pages/Transit/TransitDecrypt.js";
|
||||
|
|
|
@ -2,18 +2,19 @@ import { Margin } from "../elements/Margin";
|
|||
import { Page } from "../types/Page";
|
||||
import { changePage, setPageContent } from "../pageUtils";
|
||||
import { makeElement } from "../htmlUtils";
|
||||
import { pageState } from "../globalPageState.ts";
|
||||
import { pageState } from "../globalPageState";
|
||||
import i18next from 'i18next';
|
||||
// @ts-ignore
|
||||
import translations from "../translations/index.mjs";
|
||||
|
||||
let languageIDs = Object.getOwnPropertyNames(translations);
|
||||
const languageIDs = Object.getOwnPropertyNames(translations);
|
||||
|
||||
export class SetLanguagePage extends Page {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
render() {
|
||||
let setLanguageForm = makeElement({
|
||||
render(): void {
|
||||
const setLanguageForm = makeElement({
|
||||
tag: "form",
|
||||
id: "setLanguageForm",
|
||||
children: [
|
||||
|
@ -46,12 +47,12 @@ export class SetLanguagePage extends Page {
|
|||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
}) as HTMLFormElement;
|
||||
setPageContent(setLanguageForm);
|
||||
setLanguageForm.addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
let formData = new FormData(setLanguageForm);
|
||||
let language = formData.get("language");
|
||||
const formData = new FormData(setLanguageForm);
|
||||
const language = formData.get("language") as string;
|
||||
pageState.language = language;
|
||||
console.log(pageState.language);
|
||||
i18next.changeLanguage(language).then((t) => {
|
||||
|
@ -61,7 +62,7 @@ export class SetLanguagePage extends Page {
|
|||
});
|
||||
});
|
||||
}
|
||||
get name() {
|
||||
get name(): string {
|
||||
return i18next.t("set_language_title");
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ module.exports = {
|
|||
},
|
||||
resolve: {
|
||||
modules: ['node_modules'],
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
extensions: ['.tsx', '.ts', '.js', ".mjs"],
|
||||
},
|
||||
|
||||
module: {
|
||||
|
|
Loading…
Reference in a new issue