Skip to content

Commit 4cdabf8

Browse files
yurynixttsahi
authored andcommitted
Set tokens on context (#22)
1 parent 3fcb54a commit 4cdabf8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/@wix-astro/src/components/login.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@
283283
import { authentication, verification, recovery } from '@wix/identity';
284284
import { getMemberTokensForDirectLogin } from './login-helpers/login-helpers.js';
285285
import { wixContext } from '@wix/sdk-context';
286+
import type { WixClient } from '@wix/sdk';
287+
import type { SiteSessionAuth } from "@wix/sdk/auth/site-session";
286288

287289
class LoginForm extends HTMLElement {
288290
constructor() {
@@ -478,6 +480,9 @@
478480
response.sessionToken!
479481
);
480482

483+
// Update context
484+
(wixContext['client'] as WixClient<undefined, ReturnType<typeof SiteSessionAuth>>).auth.setTokens(tokens.tokens);
485+
481486
// Set cookie
482487
this.setCookie('wixSession', JSON.stringify(tokens), 2);
483488

0 commit comments

Comments
 (0)