File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export abstract class PostFlow<
17
17
// throw new Error('Method not implemented.');
18
18
// }
19
19
protected abstract cmd : string ;
20
- protected abstract params : object ;
20
+ protected abstract params : object | ( ( pre : CombErr < Tin > ) => object ) ;
21
21
/**
22
22
* auto-gen based on `cmd` and `params`
23
23
*
@@ -42,7 +42,11 @@ export abstract class PostFlow<
42
42
}
43
43
protected request ( pre : CombErr < Tin > ) : Observable < CombErr < Tout > > {
44
44
if ( pre [ 1 ] . length === 0 ) {
45
- this . cachePath = JSON . stringify ( [ this . cmd , this . params , pre [ 0 ] . url ] ) ;
45
+ if ( typeof this . params === 'object' )
46
+ this . cachePath = JSON . stringify ( [ this . cmd , this . params , pre [ 0 ] . url ] ) ;
47
+ else if ( typeof this . params === 'function' )
48
+ this . cachePath = JSON . stringify ( [ this . cmd , this . params ( pre ) , pre [ 0 ] . url ] ) ;
49
+ else throw Error ( 'params type is unknow.' ) ;
46
50
}
47
51
return super . request ( pre ) ;
48
52
}
You can’t perform that action at this time.
0 commit comments