@scayle/storefront-nuxt 7.40.0 → 7.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/dist/module.json
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
export declare function useSession(): {
|
|
2
|
-
login: (params: import("@scayle/storefront-core").LoginRequest) => Promise<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}>;
|
|
8
|
-
guestLogin: (params: import("@scayle/storefront-core").GuestRequest) => Promise<{
|
|
9
|
-
oauth: import("@scayle/storefront-core").Oauth | null;
|
|
2
|
+
login: (params: import("@scayle/storefront-core").LoginRequest) => Promise<undefined>;
|
|
3
|
+
register: (params: import("@scayle/storefront-core").RegisterRequest) => Promise<undefined>;
|
|
4
|
+
guestLogin: (params: import("@scayle/storefront-core").GuestRequest) => Promise<undefined>;
|
|
5
|
+
refreshToken: () => Promise<{
|
|
6
|
+
success: boolean;
|
|
10
7
|
}>;
|
|
11
|
-
refreshToken: () => Promise<import("@scayle/storefront-core").Oauth | null>;
|
|
12
8
|
revokeToken: () => Promise<{
|
|
13
9
|
result: boolean;
|
|
14
10
|
}>;
|
|
15
11
|
forgetPassword: (params: import("@scayle/storefront-core").SendResetPasswordEmailRequest) => Promise<{
|
|
16
12
|
success: boolean;
|
|
17
13
|
}>;
|
|
18
|
-
resetPasswordByHash: (params: import("@scayle/storefront-core").UpdatePasswordByHashRequest) => Promise<
|
|
19
|
-
oauth: import("@scayle/storefront-core").Oauth | null;
|
|
20
|
-
}>;
|
|
14
|
+
resetPasswordByHash: (params: import("@scayle/storefront-core").UpdatePasswordByHashRequest) => Promise<undefined>;
|
|
21
15
|
};
|
|
@@ -5,19 +5,18 @@ async function updateSession(event, data) {
|
|
|
5
5
|
Object.assign(session.data, data);
|
|
6
6
|
await session.save();
|
|
7
7
|
}
|
|
8
|
-
const updateUser = async (event
|
|
8
|
+
const updateUser = async (event) => {
|
|
9
|
+
const session = event.context.session;
|
|
9
10
|
const checkoutUrl = event.context.$rpcContext.checkout.url;
|
|
10
11
|
const shopId = event.context.$currentShop.shopId;
|
|
11
12
|
const user = await rpcMethods.fetchUser(
|
|
12
|
-
{ accessToken:
|
|
13
|
+
{ accessToken: session.data.accessToken, callback: "" },
|
|
13
14
|
{
|
|
14
15
|
checkoutUrl,
|
|
15
16
|
shopId
|
|
16
17
|
}
|
|
17
18
|
);
|
|
18
19
|
await updateSession(event, {
|
|
19
|
-
accessToken: tokens.access_token,
|
|
20
|
-
refreshToken: tokens.refresh_token,
|
|
21
20
|
user
|
|
22
21
|
});
|
|
23
22
|
};
|
|
@@ -27,13 +26,13 @@ const updateAccessTokenWithRefreshToken = async (event, sessionData, log) => {
|
|
|
27
26
|
}
|
|
28
27
|
try {
|
|
29
28
|
const context = event.context.$rpcContext;
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
29
|
+
const { success } = await rpcMethods.refreshAccessToken(context);
|
|
30
|
+
if (!success) {
|
|
32
31
|
await revokeTokensAndDestroySession(event, log);
|
|
33
32
|
return true;
|
|
34
33
|
}
|
|
35
34
|
try {
|
|
36
|
-
await updateUser(event
|
|
35
|
+
await updateUser(event);
|
|
37
36
|
return true;
|
|
38
37
|
} catch (e) {
|
|
39
38
|
log.error("api/oauth/me", {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.40.
|
|
4
|
+
"version": "7.40.1",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@nuxt/kit": "3.8.1",
|
|
64
64
|
"@scayle/h3-session": "0.3.4",
|
|
65
|
-
"@scayle/storefront-core": "7.
|
|
65
|
+
"@scayle/storefront-core": "7.26.0",
|
|
66
66
|
"@vueuse/core": "10.6.1",
|
|
67
67
|
"consola": "3.2.3",
|
|
68
68
|
"core-js": "3.33.2",
|