1
Fork 0

Narrow the ReplacementType value before saving.

This commit is contained in:
Bauke 2023-08-15 12:15:16 +02:00
parent 56b3a7da80
commit 0153c83afb
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,10 @@
import {Component} from "preact";
import {fromStorage, Feature, ReplacementType} from "../../storage/exports.js";
import {
fromStorage,
isReplacementType,
Feature,
ReplacementType,
} from "../../storage/exports.js";
import {Setting, type SettingProps} from "./index.js";
type State = {
@ -23,7 +28,7 @@ export class AnonymizeUsernamesSetting extends Component<SettingProps, State> {
replacementTypeChanged = async (event: Event) => {
const newValue = (event.target as HTMLInputElement)!.value;
const {data} = this.state;
if (data === undefined) {
if (data === undefined || !isReplacementType(newValue)) {
return;
}