Better error handling around config saving
This commit is contained in:
parent
d13b2025d5
commit
87eea284ab
|
@ -123,18 +123,34 @@
|
|||
// only if the user has provided an image, upload it.
|
||||
image && uploadLogo(image)
|
||||
let calls = []
|
||||
let completed = []
|
||||
docs.forEach(element => {
|
||||
if (element.type === ConfigTypes.OIDC) {
|
||||
//Add a UUID here so each config is distinguishable when it arrives at the login page.
|
||||
element.config.configs.forEach(config => {
|
||||
!config.uuid && (config.uuid = uuid())
|
||||
})
|
||||
oidcComplete && calls.push(api.post(`/api/admin/configs`, element))
|
||||
if (oidcComplete) {
|
||||
calls.push(api.post(`/api/admin/configs`, element))
|
||||
completed.push(ConfigTypes.OIDC)
|
||||
} else {
|
||||
notifications.error(
|
||||
`Please fill in all required ${ConfigTypes.OIDC} fields`
|
||||
)
|
||||
}
|
||||
}
|
||||
if (element.type === ConfigTypes.Google) {
|
||||
googleComplete && calls.push(api.post(`/api/admin/configs`, element))
|
||||
if (googleComplete) {
|
||||
calls.push(api.post(`/api/admin/configs`, element))
|
||||
completed.push(ConfigTypes.OIDC)
|
||||
} else {
|
||||
notifications.error(
|
||||
`Please fill in all required ${ConfigTypes.Google} fields`
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
calls.length &&
|
||||
Promise.all(calls)
|
||||
.then(responses => {
|
||||
return Promise.all(
|
||||
|
|
Loading…
Reference in New Issue