atom-nuxt 1.0.147 → 1.0.149

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@atomengine/atom-nuxt",
3
3
  "configKey": "atomNuxt",
4
- "version": "1.0.147",
4
+ "version": "1.0.149",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
@@ -62,7 +62,7 @@ const handleConfirm = () => {
62
62
  </v-card-text>
63
63
  <v-card-actions class="pa-0 border-t pa-4 elevation-5">
64
64
  <v-btn size="large" variant="flat" color="error" @click="dialog = false">
65
- Cancel
65
+ {{ cancelText }}
66
66
  </v-btn>
67
67
  <v-spacer/>
68
68
  <v-btn
@@ -74,7 +74,7 @@ const handleConfirm = () => {
74
74
  >
75
75
  <v-icon color="white" size="16" class="mr-2"
76
76
  icon="mdi-check"></v-icon>
77
- OK
77
+ {{ confirmText }}
78
78
  </v-btn>
79
79
  </v-card-actions>
80
80
 
@@ -82,42 +82,37 @@ export const useCrudApi = (path, watchPage = true, transformItem = null, transfo
82
82
  };
83
83
  }
84
84
  if (atomNuxtConfig.debug) {
85
- console.log("Request:", {
86
- url,
87
- options
88
- });
85
+ console.log("Request:", { url, options });
89
86
  }
90
- const response = await fetch(url, options);
87
+ const response = await $fetch.raw(url, {
88
+ method: options.method,
89
+ headers: options.headers,
90
+ body: options.body,
91
+ baseURL: atomNuxtConfig.apiBaseUrl
92
+ // SSR-safe
93
+ });
91
94
  if (atomNuxtConfig.debug) {
92
95
  console.log("Response Status:", response.status, response.statusText);
93
96
  console.log("Response Headers:", [...response.headers.entries()]);
94
97
  }
95
98
  if (!response.ok) {
96
- console.log("Response Failed with status:", response.status);
97
99
  if (response.status === 401 && crudOnUnauthenticated) {
98
100
  await crudOnUnauthenticated();
99
101
  }
100
- if (atomNuxtConfig.debug) {
101
- console.log("Response Failed:", response);
102
+ let errorBody;
103
+ try {
104
+ errorBody = response._data;
105
+ } catch {
106
+ errorBody = null;
102
107
  }
103
- const errorBody = await response.json().catch(() => null);
104
108
  errors.value = errorBody || { message: "Failed to parse error response" };
105
109
  throw new FetchError(response.statusText, response.status);
106
110
  }
107
- if (atomNuxtConfig.debug) {
108
- console.log("Response:", response);
109
- }
110
- const contentType = response.headers.get("content-type");
111
- let responseBody;
112
- if (contentType && contentType.includes("application/json")) {
113
- responseBody = await response.json();
114
- } else {
115
- responseBody = await response.text();
116
- }
117
- if (response.headers.get("user-message")) {
118
- setAlertMessage(response.headers.get("user-message"));
111
+ const userMessage = response.headers.get("user-message");
112
+ if (userMessage) {
113
+ setAlertMessage(userMessage);
119
114
  }
120
- return responseBody;
115
+ return response._data;
121
116
  } catch (error) {
122
117
  if (error.status === 401 && crudOnUnauthenticated) {
123
118
  await crudOnUnauthenticated();
@@ -125,6 +120,7 @@ export const useCrudApi = (path, watchPage = true, transformItem = null, transfo
125
120
  if (atomNuxtConfig.debug) {
126
121
  console.error("Request error:", error);
127
122
  }
123
+ throw error;
128
124
  } finally {
129
125
  pending.value = false;
130
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom-nuxt",
3
- "version": "1.0.147",
3
+ "version": "1.0.149",
4
4
  "description": "My new Nuxt module",
5
5
  "repository": "atomengine/atom-nuxt",
6
6
  "license": "MIT",