diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-10 12:06:26 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-10 12:06:26 +0100 |
commit | 45ba09fef3b970fb916ffb1b0ac7509db7bbdde6 (patch) | |
tree | dc0875d5c30dc895b9576eeec9711dc9a6c10774 /client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |
parent | 4e55c132a007aa5466e1ac95a998df3ca88f3fb7 (diff) | |
download | PeerTube-45ba09fef3b970fb916ffb1b0ac7509db7bbdde6.tar.gz PeerTube-45ba09fef3b970fb916ffb1b0ac7509db7bbdde6.tar.zst PeerTube-45ba09fef3b970fb916ffb1b0ac7509db7bbdde6.zip |
Improve edit config submit error
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index bbdf1bfbe..2c7a10937 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -290,6 +290,25 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
290 | this.router.navigate([], { fragment: this.activeNav }) | 290 | this.router.navigate([], { fragment: this.activeNav }) |
291 | } | 291 | } |
292 | 292 | ||
293 | grabAllErrors (errorObjectArg?: any) { | ||
294 | const errorObject = errorObjectArg || this.formErrors | ||
295 | |||
296 | let acc: string[] = [] | ||
297 | |||
298 | for (const key of Object.keys(errorObject)) { | ||
299 | const value = errorObject[key] | ||
300 | if (!value) continue | ||
301 | |||
302 | if (typeof value === 'string') { | ||
303 | acc.push(value) | ||
304 | } else { | ||
305 | acc = acc.concat(this.grabAllErrors(value)) | ||
306 | } | ||
307 | } | ||
308 | |||
309 | return acc | ||
310 | } | ||
311 | |||
293 | private updateForm () { | 312 | private updateForm () { |
294 | this.form.patchValue(this.customConfig) | 313 | this.form.patchValue(this.customConfig) |
295 | } | 314 | } |