]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/forms/form-reactive.ts
Implement daily upload limit (#956)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / forms / form-reactive.ts
index 441ec8203688830ed891f6b1f0ffeef1268d43c4..0bb7d25e6f5c606da996ae66195930b9262f14bc 100644 (file)
@@ -10,6 +10,7 @@ export type FormReactiveValidationMessages = {
 
 export abstract class FormReactive {
   protected abstract formValidatorService: FormValidatorService
+  protected formChanged = false
 
   form: FormGroup
   formErrors: FormReactiveErrors
@@ -22,7 +23,7 @@ export abstract class FormReactive {
     this.formErrors = formErrors
     this.validationMessages = validationMessages
 
-    this.form.valueChanges.subscribe(data => this.onValueChanged(false))
+    this.form.valueChanges.subscribe(() => this.onValueChanged(false))
   }
 
   protected onValueChanged (forceCheck = false) {
@@ -31,6 +32,8 @@ export abstract class FormReactive {
       this.formErrors[ field ] = ''
       const control = this.form.get(field)
 
+      if (control.dirty) this.formChanged = true
+
       // Don't care if dirty on force check
       const isDirty = control.dirty || forceCheck === true
       if (control && isDirty && !control.valid) {