@inzombieland/nuxt-common 1.16.3 → 1.16.4

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.16.3",
3
+ "version": "1.16.4",
4
4
  "configKey": "nuxt-common",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.6.0",
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.16.3";
5
+ const version = "1.16.4";
6
6
 
7
7
  const module = defineNuxtModule({
8
8
  meta: {
@@ -1,4 +1,3 @@
1
- import { useLocalStorage } from "@vueuse/core";
2
1
  import bus from "./bus.mjs";
3
2
  import { newCometClient } from "./comet-client.mjs";
4
3
  import { getVisitor } from "./get-visitor.mjs";
@@ -26,8 +25,6 @@ export const setToken = (newToken) => {
26
25
  export const flush = () => {
27
26
  setToken(null);
28
27
  setUser(null);
29
- const loggedIn = useLocalStorage("lin", "no");
30
- loggedIn.value = "no";
31
28
  };
32
29
  const eventHandler = (requestID, eventName) => {
33
30
  return new Promise((resolve, reject) => {
@@ -75,7 +72,7 @@ const errorHandler = (error) => {
75
72
  return new Error(message);
76
73
  };
77
74
  const optionsHandler = (options = {}, config) => {
78
- const { apiBaseURL, appClientID, appClientSecret, isMobileApp, isDesktopApp, getHostname } = config;
75
+ const { appClientID, appClientSecret, isMobileApp, isDesktopApp, getHostname } = config;
79
76
  const baseURL = "/api";
80
77
  const headers = {};
81
78
  const visitor = { platform: "web", hostname: getHostname() };
@@ -86,11 +83,11 @@ const optionsHandler = (options = {}, config) => {
86
83
  headers.authorization = `Basic ${credentials}`;
87
84
  }
88
85
  if (isMobileApp) {
89
- options.baseURL = apiBaseURL;
86
+ options.baseURL = baseURL;
90
87
  visitor.platform = "mobile";
91
88
  }
92
89
  if (isDesktopApp) {
93
- options.baseURL = apiBaseURL;
90
+ options.baseURL = baseURL;
94
91
  visitor.platform = "desktop";
95
92
  }
96
93
  if (typeof window !== "undefined") {
@@ -43,7 +43,8 @@ async function getUserRequest(fetch, config) {
43
43
  try {
44
44
  const user2 = await fetch("/account", config.useRequestHeaders?.(["cookie", "authorization"]));
45
45
  setUser(user2);
46
- return { token, user: user2 };
46
+ const token2 = getToken();
47
+ return { token: token2, user: user2 };
47
48
  } catch {
48
49
  flush();
49
50
  return { token: null, user: null };
@@ -22,7 +22,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
22
22
  auth.value = await getUser();
23
23
  }
24
24
  }
25
- if (auth.value) {
25
+ if (auth.value?.token && auth.value?.user) {
26
26
  setToken(auth.value.token);
27
27
  setUser(auth.value.user);
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.16.3",
3
+ "version": "1.16.4",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": {