@inzombieland/nuxt-common 1.20.2 → 1.20.3

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/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.20.2",
3
+ "version": "1.20.3",
4
4
  "configKey": "nuxt-common",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
2
2
  import { defineNuxtModule, createResolver, addServerHandler, addImportsDir, addPlugin, addComponent } from '@nuxt/kit';
3
3
 
4
4
  const name = "@inzombieland/nuxt-common";
5
- const version = "1.20.2";
5
+ const version = "1.20.3";
6
6
 
7
7
  const module$1 = defineNuxtModule({
8
8
  meta: {
@@ -1,2 +1,4 @@
1
+ export declare const getSessionId: () => string | null;
2
+ export declare const setSessionId: (sessionId?: string) => void;
1
3
  export declare const getVisitorId: () => string | null;
2
4
  export declare const setVisitorId: (visitorId?: string) => void;
@@ -1,3 +1,14 @@
1
+ export const getSessionId = () => {
2
+ if (typeof window !== "undefined") {
3
+ return window.localStorage.getItem("sid");
4
+ }
5
+ return null;
6
+ };
7
+ export const setSessionId = (sessionId = "") => {
8
+ if (typeof window !== "undefined") {
9
+ window.localStorage.setItem("sid", sessionId);
10
+ }
11
+ };
1
12
  export const getVisitorId = () => {
2
13
  if (typeof window !== "undefined") {
3
14
  return window.localStorage.getItem("vid");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/core",
3
- "version": "1.20.2",
3
+ "version": "1.20.3",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "main": "./index.js",
@@ -1,7 +1,7 @@
1
1
  import { flush, setSecretKey, setToken, updateUser } from "./api-client.js";
2
2
  import { useUser } from "./composables/index.js";
3
3
  import { once } from "./helpers/index.js";
4
- import { setVisitorId } from "./local-storage-utils.js";
4
+ import { setSessionId, setVisitorId } from "./local-storage-utils.js";
5
5
  export const createApiUserActions = once(
6
6
  (fetch, config, getUser) => {
7
7
  return {
@@ -29,21 +29,19 @@ export const createApiUserActions = once(
29
29
  });
30
30
  },
31
31
  signInByCodeVerifyCode: async (body) => {
32
- const response = await fetch(
33
- "/account/0/signinbycode/verifycode",
34
- {
35
- body,
36
- method: "POST",
37
- ...config.useRequestHeaders?.(["cookie"]) ?? {}
38
- }
39
- );
40
- const { accessToken, secretKey, visitorId, ...rest } = response;
41
- if (!accessToken) {
32
+ const response = await fetch("/account/0/signinbycode/verifycode", {
33
+ body,
34
+ method: "POST",
35
+ ...config.useRequestHeaders?.(["cookie"]) ?? {}
36
+ });
37
+ const { accessToken, sessionId, visitorId, secretKey, ...rest } = response;
38
+ if (!accessToken || !sessionId) {
42
39
  throw rest;
43
40
  }
44
41
  setToken(accessToken);
45
- setSecretKey(secretKey);
42
+ setSessionId(sessionId);
46
43
  setVisitorId(visitorId);
44
+ setSecretKey(secretKey);
47
45
  return await getUser();
48
46
  },
49
47
  getToken: async (body) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.20.2",
3
+ "version": "1.20.3",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": {