diff --git a/src/components/Login.vue b/src/components/Login.vue
index 3434fa0..d65b6bb 100644
--- a/src/components/Login.vue
+++ b/src/components/Login.vue
@@ -7,12 +7,7 @@
-
+
Iniciar Sesión
@@ -74,7 +69,7 @@
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import AuthService from '@/services/auth'
-import logo from '@/assets/logo_colorful.png'
+import SiteLogo from '@/components/SiteLogo.vue'
const router = useRouter()
diff --git a/src/components/SiteLogo.vue b/src/components/SiteLogo.vue
new file mode 100644
index 0000000..5c9052e
--- /dev/null
+++ b/src/components/SiteLogo.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
diff --git a/src/components/StoreLocation.vue b/src/components/StoreLocation.vue
index 6ead4b3..8def411 100644
--- a/src/components/StoreLocation.vue
+++ b/src/components/StoreLocation.vue
@@ -61,10 +61,12 @@
import { ref, computed, inject, onMounted, onBeforeUnmount, nextTick } from 'vue';
import L from 'leaflet';
import 'leaflet/dist/leaflet.css';
+import { useSettingsStore } from '@/stores/settings';
const api = inject('api');
+const settingsStore = useSettingsStore();
-const settings = ref(null);
+const settings = computed(() => settingsStore.settings);
const mapEl = ref(null);
let map = null;
@@ -125,7 +127,7 @@ function handleResize() {
onMounted(async () => {
try {
- settings.value = await api.getStoreSettings();
+ await settingsStore.fetchSettings(api);
await nextTick();
initMap();
} catch (error) {
diff --git a/src/components/StoreSettingsManagement.vue b/src/components/StoreSettingsManagement.vue
index 46a5fc5..d7789e1 100644
--- a/src/components/StoreSettingsManagement.vue
+++ b/src/components/StoreSettingsManagement.vue
@@ -60,6 +60,39 @@
/>
+
+
+
+
+
Logo del sitio
+
+
+
+ Quitar logo actual
+
+
@@ -82,11 +115,16 @@
diff --git a/src/services/django-api.js b/src/services/django-api.js
index ee773c7..9387579 100644
--- a/src/services/django-api.js
+++ b/src/services/django-api.js
@@ -162,7 +162,9 @@ class DjangoApi {
updateStoreSettings(data) {
const url = this.base + "/don_confiao/api/store_settings";
- return this.patchRequest(url, data);
+ return http.patch(url, data, {
+ headers: { 'Content-Type': undefined },
+ }).then((r) => r.data);
}
}
diff --git a/src/stores/settings.js b/src/stores/settings.js
new file mode 100644
index 0000000..901307f
--- /dev/null
+++ b/src/stores/settings.js
@@ -0,0 +1,26 @@
+import { defineStore } from 'pinia'
+
+export const useSettingsStore = defineStore('settings', {
+ state: () => ({
+ settings: null,
+ loaded: false
+ }),
+ getters: {
+ logo: (state) => state.settings?.logo || null,
+ address: (state) => state.settings?.address || '',
+ latitude: (state) => state.settings?.latitude,
+ longitude: (state) => state.settings?.longitude
+ },
+ actions: {
+ async fetchSettings(api) {
+ if (this.loaded) return this.settings
+ this.settings = await api.getStoreSettings()
+ this.loaded = true
+ return this.settings
+ },
+ setSettings(settings) {
+ this.settings = settings
+ this.loaded = true
+ }
+ }
+})