Skip to content

Commit 621c672

Browse files
committed
improve null checks
1 parent 461f3ed commit 621c672

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/components/login/SSOLogin.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
134134
// keeping the existing type intact
135135
.then(([ssoConfigListRes, authorizationGlobalConfig]: any) => {
136136
let ssoConfig = ssoConfigListRes.result?.find((sso) => sso.active)
137-
if (ssoConfigListRes.result && ssoConfig) {
137+
if (ssoConfig) {
138138
this.setState({ sso: ssoConfig?.name, lastActiveSSO: ssoConfig })
139139
} else {
140140
ssoConfig = sample['google']
@@ -262,7 +262,7 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
262262
: {}
263263

264264
_getSSOCreateOrUpdatePayload = (configJSON) => ({
265-
id: this.state.ssoConfig?.id,
265+
id: this.state.ssoConfig.id,
266266
name: this.state.sso,
267267
url: this.state.ssoConfig.url,
268268
config: {
@@ -281,8 +281,7 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
281281
_validateYaml = () => {
282282
let configJSON: any = {}
283283
try {
284-
configJSON = yamlJsParser.parse(this.state.ssoConfig.config.config)
285-
configJSON = this.checkConfigJson(configJSON)
284+
configJSON = this.checkConfigJson(yamlJsParser.parse(this.state.ssoConfig.config.config))
286285

287286
if (
288287
this.state.sso === SSOProvider.microsoft &&

0 commit comments

Comments
 (0)