@7365admin1/layer-common 1.11.35 → 1.11.36
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 +6 -0
- package/composables/useFeedback.ts +15 -9
- package/composables/useProfilePhotoSrc.ts +34 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -130,15 +130,15 @@ export default function useFeedback() {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
function deleteFeedback(id: string) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
133
|
+
// function deleteFeedback(id: string) {
|
|
134
|
+
// return useNuxtApp().$api<Record<string, any>>(
|
|
135
|
+
// `/api/feedbacks/deleted/feedback/${id}`,
|
|
136
|
+
// {
|
|
137
|
+
// method: "PUT",
|
|
138
|
+
// // query: { id },
|
|
139
|
+
// }
|
|
140
|
+
// );
|
|
141
|
+
// }
|
|
142
142
|
|
|
143
143
|
function updateFeedbackServiceProvider(id: string, serviceProvider: string) {
|
|
144
144
|
return useNuxtApp().$api<Record<string, any>>(
|
|
@@ -182,6 +182,12 @@ export default function useFeedback() {
|
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
function deleteFeedback(id: string) {
|
|
186
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/feedbacks/${id}`, {
|
|
187
|
+
method: "DELETE",
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
185
191
|
return {
|
|
186
192
|
feedbacks,
|
|
187
193
|
setFeedback,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type ProfilePhotoMessageLike = {
|
|
2
|
+
createdByProfile?: unknown;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export default function useProfilePhotoSrc() {
|
|
6
|
+
const { API_DO_STORAGE_ENDPOINT } = useRuntimeConfig().public;
|
|
7
|
+
|
|
8
|
+
const isProbablyUrl = (value: string) =>
|
|
9
|
+
/^(https?:\/\/|data:|blob:)/i.test(value);
|
|
10
|
+
|
|
11
|
+
const trimSlashes = (value: string) => value.replace(/^\/+|\/+$/g, "");
|
|
12
|
+
|
|
13
|
+
const joinUrl = (base: string, ...parts: string[]) => {
|
|
14
|
+
const safeBase = base.replace(/\/+$/g, "");
|
|
15
|
+
const safeParts = parts.map((p) => trimSlashes(p)).filter(Boolean);
|
|
16
|
+
return [safeBase, ...safeParts].join("/");
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const getProfilePhotoSrc = (message: ProfilePhotoMessageLike) => {
|
|
20
|
+
const rawKey = message?.createdByProfile;
|
|
21
|
+
if (typeof rawKey !== "string") return "";
|
|
22
|
+
|
|
23
|
+
const key = rawKey.trim();
|
|
24
|
+
if (!key) return "";
|
|
25
|
+
|
|
26
|
+
if (isProbablyUrl(key)) return key;
|
|
27
|
+
|
|
28
|
+
return joinUrl(String(API_DO_STORAGE_ENDPOINT || ""), key);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
getProfilePhotoSrc,
|
|
33
|
+
};
|
|
34
|
+
}
|