Skip to content

Commit

Permalink
chore: update counter example
Browse files Browse the repository at this point in the history
  • Loading branch information
k3nsei committed Dec 21, 2024
1 parent ca08924 commit f3767ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/demo/src/app/counter/counter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export class CounterComponent {
protected readonly isBusy = computed(() => this.store.counterMutation.isPending());

protected increaseBy(amount: number): void {
this.store.counterMutation.mutate(amount);
this.store.increaseBy(amount);
}
}
7 changes: 6 additions & 1 deletion apps/demo/src/app/counter/counter.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';

import { MatSnackBar } from '@angular/material/snack-bar';

import { patchState, signalStore, withState } from '@ngrx/signals';
import { patchState, signalStore, withMethods, withState } from '@ngrx/signals';
import { withMutation } from '@ngx-signal-store-query/core';
import { lastValueFrom } from 'rxjs';

Expand Down Expand Up @@ -31,4 +31,9 @@ export const CounterStore = signalStore(
},
};
}),
withMethods(({ counterMutation }) => ({
increaseBy(amount: number): void {
return counterMutation.mutate(amount);
},
})),
);

0 comments on commit f3767ed

Please sign in to comment.