1
0
Эх сурвалжийг харах

fix(core): Fix error when de-serializing a RequestContext without expiry

Michael Bromley 5 жил өмнө
parent
commit
a1e03fd098

+ 4 - 1
packages/core/src/api/common/request-context.ts

@@ -63,7 +63,10 @@ export class RequestContext {
         return new RequestContext({
         return new RequestContext({
             apiType: ctxObject._apiType,
             apiType: ctxObject._apiType,
             channel: new Channel(ctxObject._channel),
             channel: new Channel(ctxObject._channel),
-            session: { ...ctxObject._session, expires: new Date(ctxObject._session.expires) },
+            session: {
+                ...ctxObject._session,
+                expires: ctxObject._session?.expires && new Date(ctxObject._session.expires),
+            },
             languageCode: ctxObject._languageCode,
             languageCode: ctxObject._languageCode,
             isAuthorized: ctxObject._isAuthorized,
             isAuthorized: ctxObject._isAuthorized,
             authorizedAsOwnerOnly: ctxObject._authorizedAsOwnerOnly,
             authorizedAsOwnerOnly: ctxObject._authorizedAsOwnerOnly,