How to use the @datorama/akita.logAction function in @datorama/akita

To help you get started, we’ve selected a few @datorama/akita examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github datorama / akita / angular / playground / projects / ng-forms-manager / src / lib / forms-manager.ts View on Github external
private updateStore(formName: keyof FormsState, form: AbstractControl, initial = false) {
    const value = this.buildFormStoreState(formName, form);
    const capitalized = formName[0].toUpperCase() + (formName as any).slice(1);
    const action = `${initial ? 'Create' : 'Update'} ${capitalized} Form`;
    logAction(action);
    this.store.update({
      [formName]: value
    } as any);
  }
github datorama / akita / angular / playground / projects / ng-forms-manager / src / lib / forms-manager.ts View on Github external
private removeFromStore(formName: keyof FormsState) {
    const snapshot = this.query.getValue();
    const newState: Partial = Object.keys(snapshot).reduce((acc, currentFormName) => {
      if (formName !== currentFormName) {
        acc[currentFormName] = snapshot[currentFormName];
      }
      return acc;
    }, {});

    logAction(`Remove ${formName}`);
    this.store._setState(() => newState as any);
  }