70 lines
1.7 KiB
Vue
70 lines
1.7 KiB
Vue
|
|
<template>
|
||
|
|
<header>
|
||
|
|
<h1><font-awesome-icon icon="images" /> <span> Gestion des médias</span></h1>
|
||
|
|
<select v-model="sujet" id="sujet_selector">
|
||
|
|
<option v-for="sujet in oSujets" :value="sujet.codeSujet">
|
||
|
|
{{ sujet.libelle }}
|
||
|
|
</option>
|
||
|
|
</select>
|
||
|
|
<div class="close_side_menu"><font-awesome-icon icon="chevron-left" /></div>
|
||
|
|
</header>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import axios from "axios";
|
||
|
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: "MmSideHeaderComponent",
|
||
|
|
components: { FontAwesomeIcon },
|
||
|
|
mounted() {
|
||
|
|
const data = JSON.parse(this.$parent.$options.json);
|
||
|
|
this.oSujets = data.sujets;
|
||
|
|
this.sujet = data.current;
|
||
|
|
this.fetchDataBySujet();
|
||
|
|
},
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
oSujets: [],
|
||
|
|
sujet: 1,
|
||
|
|
};
|
||
|
|
},
|
||
|
|
watch: {
|
||
|
|
sujet() {
|
||
|
|
this.fetchDataBySujet();
|
||
|
|
},
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
fetchDataBySujet() {
|
||
|
|
axios
|
||
|
|
.get(`/ajax/get-datas-by-sujet/${this.sujet}`)
|
||
|
|
.then((response) => {
|
||
|
|
this.$store.commit({
|
||
|
|
type: "updateSujet",
|
||
|
|
sujet: this.sujet,
|
||
|
|
});
|
||
|
|
this.$store.commit({
|
||
|
|
type: "updateTypesVue",
|
||
|
|
typesvue: response.data.typesvue,
|
||
|
|
});
|
||
|
|
this.$store.commit({
|
||
|
|
type: "updateTypesVariantes",
|
||
|
|
typesvariantes: response.data.typesvariantes,
|
||
|
|
});
|
||
|
|
this.$store.commit({
|
||
|
|
type: "updateFormats",
|
||
|
|
formats: response.data.formats,
|
||
|
|
});
|
||
|
|
})
|
||
|
|
.catch(function (error) {
|
||
|
|
if (error?.response?.status === 419) {
|
||
|
|
__DAM.methods.sessionTimedOut();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
console.log(error);
|
||
|
|
});
|
||
|
|
},
|
||
|
|
},
|
||
|
|
};
|
||
|
|
</script>
|