fix: ensure regTy is always uppercase

This commit is contained in:
Alexis Tyler
2021-04-30 07:38:47 +09:30
parent a7a80c1243
commit db13e10e9f
3 changed files with 7 additions and 7 deletions

View File

@@ -261,7 +261,7 @@ const parse = (state: VarIni): Var => {
portssl: toNumber(state.portssl),
porttelnet: toNumber(state.porttelnet),
regCheck: state.regCheck === '' ? 'Valid' : 'Error',
regTy: ['Basic', 'Plus', 'Pro'].includes(state.regTy) ? state.regTy : 'Invalid',
regTy: (['Basic', 'Plus', 'Pro'].includes(state.regTy) ? state.regTy : 'Invalid').toUpperCase(),
// Make sure to use a || not a ?? as regCheck can be an empty string
regState: (state.regCheck || state.regTy).toUpperCase(),
safeMode: iniBooleanToJsBoolean(state.safeMode),

View File

@@ -6,7 +6,7 @@
// @todo: remove string and add rest of the options
type FsType = 'xfs' | string;
type RegistrationCheck = 'Error' | 'Valid';
type RegistrationType = 'Invalid' | 'Basic' | 'Plus' | 'Pro' | string;
type RegistrationType = 'INVALID' | 'BASIC' | 'PLUS' | 'PRO' | string;
/**
* Global vars

View File

@@ -176,13 +176,13 @@ enum mdState {
enum registrationType {
"""Basic"""
Basic
BASIC
"""Plus"""
Plus
PLUS
"""Pro"""
Pro
"""Invalid"""
Invalid
PRO
"""nvalid"""
INVALID
}
enum registrationState {