|
@@ -7,7 +7,7 @@
|
|
|
<div class="col col-left">
|
|
|
<section class="body" v-html="thematique.body"></section>
|
|
|
<section class="visuel">
|
|
|
- <img :src="image_accroche.style_cardmedium.url" alt="">
|
|
|
+ <img :src="image_accroche.style_cardfull_url" alt="">
|
|
|
</section>
|
|
|
</div> <!-- //col-left -->
|
|
|
<div class="col col-right">
|
|
@@ -76,50 +76,41 @@ export default {
|
|
|
// }),
|
|
|
getThematique(){
|
|
|
console.log('getThematique', this.$route);
|
|
|
- // get the article uuid
|
|
|
- // if(this.$route.query.nid){
|
|
|
- // // we come from internal link with vuejs
|
|
|
- // // directly record uuid
|
|
|
- // this.nid = this.$route.query.nid
|
|
|
- //
|
|
|
- // }else if(drupalDecoupled.entity_type == 'node' && drupalDecoupled.entity_bundle == 'article'){
|
|
|
- // // we landed in an internal page
|
|
|
- // // get the uuid from drupalDeclouped, provided by materio_decoupled.module
|
|
|
- // this.nid = drupalDecoupled.entity_id
|
|
|
- // }
|
|
|
-
|
|
|
- if (this.$route.path) {
|
|
|
+ if (this.$route.params.id) {
|
|
|
// we come from internal link with vuejs
|
|
|
- this.path = this.$route.path
|
|
|
- } else {
|
|
|
+ // using path to load from route is hasardous
|
|
|
+ // this.path = this.$route.path
|
|
|
+ this.id = this.$route.params.id
|
|
|
+ }else if(drupalDecoupled.entity_type == 'node' && drupalDecoupled.entity_bundle == 'thematique'){
|
|
|
// we landed in an internal page
|
|
|
- this.path = window.location.pathname
|
|
|
+ // get the id from drupalDeclouped, provided by materio_decoupled.module
|
|
|
+ this.id = drupalDecoupled.entity_id
|
|
|
}
|
|
|
|
|
|
- if(this.path){
|
|
|
+ if(this.id){
|
|
|
this.loadThematique()
|
|
|
}else{
|
|
|
- // if for any reason we dont have the uuid
|
|
|
- // redirect to home
|
|
|
- this.$route.replace('home')
|
|
|
+ // if for any reason we dont have the id redirect to home
|
|
|
+ this.$router.replace({name:'home'})
|
|
|
}
|
|
|
},
|
|
|
loadThematique(){
|
|
|
console.log('loadThematique')
|
|
|
this.loading = true
|
|
|
-
|
|
|
+ //
|
|
|
let ast = gql`{
|
|
|
- route(path: "${this.path}", lang: "${drupalDecoupled.lang_code}") {
|
|
|
+ thematique(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
|
|
|
...ThematiqueFields
|
|
|
}
|
|
|
}
|
|
|
${ thematiqueFields }
|
|
|
`
|
|
|
+ // ?XDEBUG_SESSION_START=1
|
|
|
MGQ.post('', { query: print(ast)
|
|
|
})
|
|
|
- .then(({ data:{data:{route}}}) => {
|
|
|
- console.log('loaded Thematique', route)
|
|
|
- this.parseDataGQL(route)
|
|
|
+ .then(({ data:{data:{thematique}}}) => {
|
|
|
+ console.log('loaded Thematique', thematique)
|
|
|
+ this.parseDataGQL(thematique)
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.warn('Issue with loadThematique', error)
|