transition modale et début history

This commit is contained in:
Valentin
2024-07-31 02:13:40 +02:00
parent 35ec4a8388
commit a05f81c2d9
4 changed files with 109 additions and 58 deletions

View File

@@ -2,9 +2,9 @@ import { defineStore } from 'pinia';
import REST from '../api/rest-axios';
export const useContentStore = defineStore('content', {
state: () => ({
state: () => ({
href: '',
etape: {
href: '',
title: '',
adresse: {},
etape_number: '',
@@ -17,7 +17,6 @@ export const useContentStore = defineStore('content', {
vignette: {},
},
page: {
href: '',
title: '',
text: '',
},
@@ -28,6 +27,7 @@ export const useContentStore = defineStore('content', {
async fetchEtapeData(nid) {
this.loading = true;
this.error = null;
this.etape = {};
this.page = {};
try {
const response = await REST.get(`/jsonapi/node/etape/`);
@@ -35,7 +35,7 @@ export const useContentStore = defineStore('content', {
if (etape.attributes.drupal_internal__nid == nid) {
for (let metatag of etape.attributes.metatag) {
if (metatag.tag === "link") {
this.etape.href = metatag.attributes.href;
this.href = metatag.attributes.href;
}
}
this.etape.title = etape.attributes.title;
@@ -69,6 +69,7 @@ export const useContentStore = defineStore('content', {
this.loading = true;
this.error = null;
this.etape = {};
this.page = {};
try {
const response = await REST.get(`/jsonapi/node/static/`);
for (let staticContent of response.data.data) {
@@ -78,11 +79,10 @@ export const useContentStore = defineStore('content', {
this.page.title = item.attributes.content;
}
if (item.tag === 'link') {
this.page.href = item.attributes.href;
this.href = item.attributes.href;
}
})
this.page.text = staticContent.attributes.field_texte.value;
console.log(this.page.title, this.page.href, this.page.text);
}
}
} catch (error) {