Skip to content

Commit 81ae5fa

Browse files
committed
fix(pencil): Always store last session
1 parent 8bfb1ea commit 81ae5fa

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/interceptors/http-server-interceptor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export default class HttpServerInterceptor extends Interceptor implements IInter
7474
if (this && this.sn_finished) {
7575
return;
7676
}
77-
intercept(this.req && this.req.sn_uid, 'write');
77+
if (arguments.length > 0 && arguments[0] !== undefined) {
78+
intercept(this.req && this.req.sn_uid, 'write');
79+
}
7880
return original.apply(this, arguments);
7981
};
8082
});

src/session-manager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ export interface Session {
66
}
77

88
export default class SessionManager {
9-
private static lastSessionId = '';
9+
private static lastSession = null;
1010
private static session: Map<string, Session> = new Map<string, Session>();
1111

1212
static getLastSession(): Session {
13-
return SessionManager.session.get(SessionManager.lastSessionId) || { req: null, res: null };
13+
return SessionManager.lastSession || { req: null, res: null };
1414
}
1515

1616
static getSession(id: string): Session {
@@ -23,7 +23,7 @@ export default class SessionManager {
2323
SessionManager.session.set(id, session);
2424

2525
//save last session
26-
SessionManager.lastSessionId = id;
26+
SessionManager.lastSession = session;
2727
}
2828

2929
static cleanSession(id: string) {

0 commit comments

Comments
 (0)