diff --git a/src/components/admin/management/setting/ClubImageSetting.vue b/src/components/admin/management/setting/ClubImageSetting.vue
index 1a1d675..adc4630 100644
--- a/src/components/admin/management/setting/ClubImageSetting.vue
+++ b/src/components/admin/management/setting/ClubImageSetting.vue
@@ -12,14 +12,14 @@
>
Kein eigenes Icon ausgewählt
-
+
-
+
Vereins-Logo
@@ -33,14 +33,14 @@
>
Kein eigenes Logo ausgewählt
-
+
-
+
@@ -135,11 +135,15 @@ export default defineComponent({
return this.uploadImage([
{
key: "club.icon",
- value: (this.$refs.icon as HTMLInputElement).files?.[0],
+ value:
+ (this.$refs.icon as HTMLInputElement).files?.[0] ??
+ (this.icon != "" && !this.overwriteIcon ? "keep" : undefined),
},
{
key: "club.logo",
- value: (this.$refs.logo as HTMLInputElement).files?.[0],
+ value:
+ (this.$refs.logo as HTMLInputElement).files?.[0] ??
+ (this.logo != "" && !this.overwriteLogo ? "keep" : undefined),
},
]);
},
diff --git a/src/stores/admin/management/setting.ts b/src/stores/admin/management/setting.ts
index 98bd8a8..da8b455 100644
--- a/src/stores/admin/management/setting.ts
+++ b/src/stores/admin/management/setting.ts
@@ -74,10 +74,14 @@ export const useSettingStore = defineStore("setting", {
return res;
});
},
- async uploadImage(data: { key: "club.logo" | "club.icon"; value?: File }[]): Promise> {
+ async uploadImage(
+ data: { key: "club.logo" | "club.icon"; value?: File | "keep" }[]
+ ): Promise> {
const formData = new FormData();
for (let entry of data) {
- if (entry.value) formData.append(entry.key, entry.value);
+ if (entry.value) {
+ formData.append(typeof entry.value == "string" ? entry.key : entry.key.split(".")[1], entry.value);
+ }
}
return await http
.put("/admin/setting/images", formData, {