@goweekdays/layer-common 1.5.4 → 1.5.6

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
@@ -1,5 +1,17 @@
1
1
  # @goweekdays/layer-common
2
2
 
3
+ ## 1.5.6
4
+
5
+ ### Patch Changes
6
+
7
+ - ad670f0: Refactor logout to call API and clear cookies
8
+
9
+ ## 1.5.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 74535b7: Update subscription API endpoint for seat management
14
+
3
15
  ## 1.5.4
4
16
 
5
17
  ### Patch Changes
@@ -19,12 +19,24 @@ export default function useLocalAuth() {
19
19
  });
20
20
  }
21
21
 
22
- async function logout() {
22
+ function clearCookies() {
23
23
  useCookie("sid", cookieConfig).value = null;
24
24
  useCookie("user", cookieConfig).value = null;
25
25
  useCookie("role", cookieConfig).value = null;
26
26
  }
27
27
 
28
+ async function logout() {
29
+ try {
30
+ await useNuxtApp().$api<Record<string, any>>("/api/auth/logout", {
31
+ method: "DELETE",
32
+ });
33
+
34
+ await clearCookies();
35
+ } catch (error: any) {
36
+ console.log(error.response._data.message || "Error logging out");
37
+ }
38
+ }
39
+
28
40
  async function getCurrentUser() {
29
41
  const user = useCookie("user", cookieConfig).value;
30
42
  if (!user) return null;
@@ -81,7 +81,7 @@ export default function useSubscription() {
81
81
  plan: string;
82
82
  user: string;
83
83
  }) {
84
- return useNuxtApp().$api<Record<string, any>>(`/api/subscriptions`, {
84
+ return useNuxtApp().$api<Record<string, any>>(`/api/subscriptions/seats`, {
85
85
  method: "PATCH",
86
86
  body: value,
87
87
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@goweekdays/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.5.4",
5
+ "version": "1.5.6",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"