atom-nuxt 1.0.149 → 1.0.151
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 +1 -1
- package/dist/runtime/components/CrudAddressSearchField.vue +2 -0
- package/dist/runtime/components/CrudListLoader.vue +5 -1
- package/dist/runtime/components/CrudListLoader.vue.d.ts +1 -0
- package/dist/runtime/components/CrudUploadField.vue +1 -1
- package/dist/runtime/composables/useCrudApi.js +22 -18
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -8,6 +8,7 @@ const addressSearchResults = ref([]);
|
|
|
8
8
|
const loading = ref(false);
|
|
9
9
|
const selectedPlaceId = ref(null);
|
|
10
10
|
const model = defineModel();
|
|
11
|
+
const placeModel = defineModel("place");
|
|
11
12
|
const fetchAutocompleteSuggestions = async (query) => {
|
|
12
13
|
if (!query || loading.value) return;
|
|
13
14
|
loading.value = true;
|
|
@@ -54,6 +55,7 @@ const fetchPlaceId = async (placeId) => {
|
|
|
54
55
|
}
|
|
55
56
|
);
|
|
56
57
|
if (result.status === "OK") {
|
|
58
|
+
placeModel.value = result.result;
|
|
57
59
|
model.value = `${result.result.geometry.location.lat},${result.result.geometry.location.lng}`;
|
|
58
60
|
} else {
|
|
59
61
|
console.error("Error fetching place details:", result.status);
|
|
@@ -9,6 +9,10 @@ const props = defineProps({
|
|
|
9
9
|
type: Boolean,
|
|
10
10
|
default: false
|
|
11
11
|
},
|
|
12
|
+
disableNoResults: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
12
16
|
path: {
|
|
13
17
|
type: String,
|
|
14
18
|
required: true
|
|
@@ -104,7 +108,7 @@ onBeforeUnmount(() => {
|
|
|
104
108
|
<slot v-if="hasListErrors" name="errors">
|
|
105
109
|
<crud-error-display :errors="listErrors"/>
|
|
106
110
|
</slot>
|
|
107
|
-
<slot v-if="!listPending && totalItems === 0" name="empty">
|
|
111
|
+
<slot v-if="!listPending && totalItems === 0 && !disableNoResults" name="empty">
|
|
108
112
|
<v-alert icon="mdi-playlist-remove" type="info" >
|
|
109
113
|
{{ noResultsText }}
|
|
110
114
|
</v-alert>
|
|
@@ -151,7 +151,7 @@ watch(() => fileToUpload.value, () => {
|
|
|
151
151
|
<div>
|
|
152
152
|
<div v-if="title" style="font-size: 12px;" class="text-grey-darken-2 mb-1">{{ title }}</div>
|
|
153
153
|
|
|
154
|
-
<div
|
|
154
|
+
<div class="mb-3">
|
|
155
155
|
<v-btn :disabled="disabled" @click="dialog = true" size="small" color="success">
|
|
156
156
|
Select Media
|
|
157
157
|
</v-btn>
|
|
@@ -82,37 +82,42 @@ export const useCrudApi = (path, watchPage = true, transformItem = null, transfo
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
if (atomNuxtConfig.debug) {
|
|
85
|
-
console.log("Request:", {
|
|
85
|
+
console.log("Request:", {
|
|
86
|
+
url,
|
|
87
|
+
options
|
|
88
|
+
});
|
|
86
89
|
}
|
|
87
|
-
const response = await
|
|
88
|
-
method: options.method,
|
|
89
|
-
headers: options.headers,
|
|
90
|
-
body: options.body,
|
|
91
|
-
baseURL: atomNuxtConfig.apiBaseUrl
|
|
92
|
-
// SSR-safe
|
|
93
|
-
});
|
|
90
|
+
const response = await fetch(url, options);
|
|
94
91
|
if (atomNuxtConfig.debug) {
|
|
95
92
|
console.log("Response Status:", response.status, response.statusText);
|
|
96
93
|
console.log("Response Headers:", [...response.headers.entries()]);
|
|
97
94
|
}
|
|
98
95
|
if (!response.ok) {
|
|
96
|
+
console.log("Response Failed with status:", response.status);
|
|
99
97
|
if (response.status === 401 && crudOnUnauthenticated) {
|
|
100
98
|
await crudOnUnauthenticated();
|
|
101
99
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
errorBody = response._data;
|
|
105
|
-
} catch {
|
|
106
|
-
errorBody = null;
|
|
100
|
+
if (atomNuxtConfig.debug) {
|
|
101
|
+
console.log("Response Failed:", response);
|
|
107
102
|
}
|
|
103
|
+
const errorBody = await response.json().catch(() => null);
|
|
108
104
|
errors.value = errorBody || { message: "Failed to parse error response" };
|
|
109
105
|
throw new FetchError(response.statusText, response.status);
|
|
110
106
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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"));
|
|
114
119
|
}
|
|
115
|
-
return
|
|
120
|
+
return responseBody;
|
|
116
121
|
} catch (error) {
|
|
117
122
|
if (error.status === 401 && crudOnUnauthenticated) {
|
|
118
123
|
await crudOnUnauthenticated();
|
|
@@ -120,7 +125,6 @@ export const useCrudApi = (path, watchPage = true, transformItem = null, transfo
|
|
|
120
125
|
if (atomNuxtConfig.debug) {
|
|
121
126
|
console.error("Request error:", error);
|
|
122
127
|
}
|
|
123
|
-
throw error;
|
|
124
128
|
} finally {
|
|
125
129
|
pending.value = false;
|
|
126
130
|
}
|