@goweekdays/layer-common 1.5.5 → 1.5.7

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.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 19c41e0: Add nextPromoCode field to TSubscription type
8
+
9
+ ## 1.5.6
10
+
11
+ ### Patch Changes
12
+
13
+ - ad670f0: Refactor logout to call API and clear cookies
14
+
3
15
  ## 1.5.5
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;
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.5",
5
+ "version": "1.5.7",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -7,6 +7,7 @@ declare type TSubscription = {
7
7
  currency: string;
8
8
  billingCycle: "monthly" | "yearly"; // e.g., 'monthly', 'yearly'
9
9
  promoCode?: string;
10
+ nextPromoCode?: string;
10
11
  status?: string;
11
12
  nextBillingDate: string;
12
13
  createdAt?: string;