@@ -6,8 +6,14 @@ import {SnackReporter} from '../snack/SnackManager';
66import { IClient } from '../types' ;
77
88export class ClientStore extends BaseStore < IClient > {
9- public constructor ( private readonly snack : SnackReporter ) {
9+ private readonly snack : SnackReporter ;
10+ public constructor ( snack : SnackReporter ) {
1011 super ( ) ;
12+ this . snack = snack ;
13+ this . update = action ( this . update ) ;
14+ this . createNoNotifcation = action ( this . createNoNotifcation ) ;
15+ this . create = action ( this . create ) ;
16+ this . elevate = action ( this . elevate ) ;
1117 }
1218
1319 protected requestItems = ( ) : Promise < IClient [ ] > =>
@@ -19,7 +25,6 @@ export class ClientStore extends BaseStore<IClient> {
1925 . then ( ( ) => this . snack ( 'Client deleted' ) ) ;
2026 }
2127
22- @action
2328 public update = async (
2429 id : number ,
2530 name : string ,
@@ -33,7 +38,6 @@ export class ClientStore extends BaseStore<IClient> {
3338 this . snack ( 'Client updated' ) ;
3439 } ;
3540
36- @action
3741 public createNoNotifcation = async (
3842 name : string ,
3943 expiresAfterInactivitySeconds = 0
@@ -46,14 +50,12 @@ export class ClientStore extends BaseStore<IClient> {
4650 return client . data ;
4751 } ;
4852
49- @action
5053 public create = async ( name : string , expiresAfterInactivitySeconds = 0 ) : Promise < string > => {
5154 const client = await this . createNoNotifcation ( name , expiresAfterInactivitySeconds ) ;
5255 this . snack ( 'Client added' ) ;
5356 return client . token ;
5457 } ;
5558
56- @action
5759 public elevate = async ( id : number , durationSeconds : number ) : Promise < void > => {
5860 await axios . post ( `${ config . get ( 'url' ) } client/${ id } /elevate` , { durationSeconds} ) ;
5961 await this . refresh ( ) ;
0 commit comments