File tree 1 file changed +11
-6
lines changed 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,23 @@ import {Moment} from "moment";
8
8
9
9
class Session {
10
10
11
- static readonly VALIDITY_MINUTES = 60 ;
11
+ static readonly VALIDITY_MINUTES = 2 ;
12
+
13
+ private validUntil : Moment ;
12
14
13
15
constructor (
14
16
public sessionId :string ,
15
- public user :User ,
16
- public validUntil : Moment ) {
17
+ public user :User ) {
18
+
19
+ this . validUntil = moment ( ) . add ( Session . VALIDITY_MINUTES , 'minutes' ) ;
17
20
18
21
}
19
22
20
23
isValid ( ) {
21
- return moment ( ) . diff ( this . validUntil , 'minutes' ) < Session . VALIDITY_MINUTES ;
24
+
25
+ console . log ( "diff" , moment ( ) . diff ( this . validUntil , 'minutes' ) ) ;
26
+
27
+ return moment ( ) . diff ( this . validUntil , 'minutes' ) <= 0 ;
22
28
}
23
29
24
30
}
@@ -31,8 +37,7 @@ class SessionStore {
31
37
createSession ( sessionId :string , user : User ) {
32
38
this . sessions [ sessionId ] = new Session (
33
39
sessionId ,
34
- user ,
35
- moment ( ) . add ( 1 , 'hours' )
40
+ user
36
41
) ;
37
42
}
38
43
You can’t perform that action at this time.
0 commit comments