added session_limit, adapted ajax calls (axios interceptor) in theme
This commit is contained in:
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -4,4 +4,4 @@
|
||||
}
|
||||
}
|
||||
${m()}
|
||||
`;l.E.post("",{query:(0,r.S)(e)}).then((({data:{data:{article:e}}})=>{this.parseDataGQL(e)})).catch((e=>{console.warn("Issue with loadArticle",e),Promise.reject(e)}))},parseDataGQL(e){this.article=e,this.items.length?this.getIndex():this.getItems().then((()=>{this.getIndex()})),this.image_accroche=e.images[0],this.lightbox_items=[];for(let t=0;t<e.images.length;t++)e.images[t].thumb=e.images[t].style_articlecardmedium.url,this.lightbox_items.push(e.images[t]);for(let t=0;t<e.videos.length;t++){let i=e.videos[t].url,n=null,a=null;switch(/https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/.exec(i).groups.provider){case"vimeo":n=/https:\/\/vimeo\.com\/(?<id>\d+)/.exec(i).groups.id||null,a="http://blogpeda.ac-poitiers.fr/ent-lyc/files/2015/06/Vimeo_icon_block.png";break;case"youtube":n=/https:\/\/(www\.)?youtube\.com\/watch\?v=(?<id>.+)/.exec(i).groups.id||null,a="http://img.youtube.com/vi/"+n+"/0.jpg"}this.lightbox_items.push({url:i,title:"",description:"",thumb:a})}this.lightbox_items,this.$store.commit("Common/setPagetitle",e.title),this.loading=!1},onPrevNext(e){let t=e.view_node.replace(/^\/\D{2,3}\/blabla\//g,"");this.$router.push({name:"article",params:{alias:t,id:e.nid}})},setLightboxIndex(e){this.lightbox_index=e}},components:{Card:u.Z},watch:{$route(e,t){this.getArticle()}}};var h=(0,i(1900).Z)(g,n,[],!1,null,"74fbee19",null);h.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Article.vue";const _=h.exports}}]);
|
||||
`;l.Z.post("",{query:(0,r.S)(e)}).then((({data:{data:{article:e}}})=>{this.parseDataGQL(e)})).catch((e=>{console.warn("Issue with loadArticle",e),Promise.reject(e)}))},parseDataGQL(e){this.article=e,this.items.length?this.getIndex():this.getItems().then((()=>{this.getIndex()})),this.image_accroche=e.images[0],this.lightbox_items=[];for(let t=0;t<e.images.length;t++)e.images[t].thumb=e.images[t].style_articlecardmedium.url,this.lightbox_items.push(e.images[t]);for(let t=0;t<e.videos.length;t++){let i=e.videos[t].url,n=null,a=null;switch(/https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/.exec(i).groups.provider){case"vimeo":n=/https:\/\/vimeo\.com\/(?<id>\d+)/.exec(i).groups.id||null,a="http://blogpeda.ac-poitiers.fr/ent-lyc/files/2015/06/Vimeo_icon_block.png";break;case"youtube":n=/https:\/\/(www\.)?youtube\.com\/watch\?v=(?<id>.+)/.exec(i).groups.id||null,a="http://img.youtube.com/vi/"+n+"/0.jpg"}this.lightbox_items.push({url:i,title:"",description:"",thumb:a})}this.lightbox_items,this.$store.commit("Common/setPagetitle",e.title),this.loading=!1},onPrevNext(e){let t=e.view_node.replace(/^\/\D{2,3}\/blabla\//g,"");this.$router.push({name:"article",params:{alias:t,id:e.nid}})},setLightboxIndex(e){this.lightbox_index=e}},components:{Card:u.Z},watch:{$route(e,t){this.getArticle()}}};var h=(0,i(1900).Z)(g,n,[],!1,null,"74fbee19",null);h.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Article.vue";const _=h.exports}}]);
|
Binary file not shown.
@@ -4,4 +4,4 @@
|
||||
}
|
||||
}
|
||||
${c()}
|
||||
`;l.E.post("",{query:(0,d.S)(e)}).then((({data:{data:{thematique:e}}})=>{this.parseDataGQL(e)})).catch((e=>{console.warn("Issue with loadThematique",e),Promise.reject(e)}))},parseDataGQL(e){e?(this.thematique=e,e.images&&(this.image_accroche=e.images[0]),this.$store.commit("Common/setPagetitle",e.title)):console.warn("Thematique not loaded"),this.loading=!1}},components:{Card:u.Z},watch:{$route(e,t){this.getThematique()}}};var g=(0,i(1900).Z)(h,a,[],!1,null,"128bc334",null);g.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Thematique.vue";const _=g.exports}}]);
|
||||
`;l.Z.post("",{query:(0,d.S)(e)}).then((({data:{data:{thematique:e}}})=>{this.parseDataGQL(e)})).catch((e=>{console.warn("Issue with loadThematique",e),Promise.reject(e)}))},parseDataGQL(e){e?(this.thematique=e,e.images&&(this.image_accroche=e.images[0]),this.$store.commit("Common/setPagetitle",e.title)):console.warn("Thematique not loaded"),this.loading=!1}},components:{Card:u.Z},watch:{$route(e,t){this.getThematique()}}};var g=(0,i(1900).Z)(h,a,[],!1,null,"128bc334",null);g.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Thematique.vue";const _=g.exports}}]);
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -58,7 +58,7 @@ import 'slim-select/slimselect.min.css'
|
||||
import 'theme/assets/styles/main.scss'
|
||||
import 'theme/assets/styles/print.scss'
|
||||
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
|
||||
export let _v_sitebranding_block, _v_user_block, _v_header_menu,
|
||||
_v_pagetitle_block, _v_search_block,
|
||||
|
@@ -5,7 +5,7 @@ import axios from 'axios'
|
||||
// console.log('drupalSettings', drupalSettings)
|
||||
console.log(window.location)
|
||||
|
||||
export const MGQ = axios.create({
|
||||
const MGQ = axios.create({
|
||||
baseURL: window.location.origin + '/mgq',
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
@@ -15,3 +15,19 @@ export const MGQ = axios.create({
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
MGQ.interceptors.response.use(
|
||||
response => {
|
||||
return Promise.resolve(response)
|
||||
},
|
||||
error => {
|
||||
const { status } = error.response
|
||||
console.warn('error in graphql-axios', status)
|
||||
if (status === 403) {
|
||||
window.location = '/'
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export default MGQ
|
||||
|
@@ -5,7 +5,7 @@ import axios from 'axios'
|
||||
// console.log('drupalSettings', drupalSettings)
|
||||
console.log(window.location)
|
||||
|
||||
export const JSONAPI = axios.create({
|
||||
const JSONAPI = axios.create({
|
||||
baseURL: window.location.origin+`/jsonapi`,
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
@@ -14,3 +14,19 @@ export const JSONAPI = axios.create({
|
||||
// 'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
JSONAPI.interceptors.response.use(
|
||||
response => {
|
||||
return Promise.resolve(response)
|
||||
},
|
||||
error => {
|
||||
const { status } = error.response
|
||||
console.warn('error in json-axios', status)
|
||||
if (status === 403) {
|
||||
window.location = '/'
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export default JSONAPI
|
||||
|
@@ -4,7 +4,7 @@ import axios from 'axios'
|
||||
|
||||
// console.log('drupalSettings', drupalSettings)
|
||||
|
||||
export const MA = axios.create({
|
||||
const MA = axios.create({
|
||||
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
@@ -12,3 +12,21 @@ export const MA = axios.create({
|
||||
// "X-CSRF-Token": "csrf_token"
|
||||
}
|
||||
})
|
||||
|
||||
MA.interceptors.response.use(
|
||||
response => {
|
||||
// console.log('ma-axios interceptor response', response)
|
||||
return Promise.resolve(response)
|
||||
// return response
|
||||
},
|
||||
error => {
|
||||
const { status } = error.response
|
||||
console.warn('error in ma-axios interceptor', status)
|
||||
if (status === 403) {
|
||||
window.location = '/'
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export default MA
|
||||
|
@@ -5,7 +5,7 @@ import axios from 'axios'
|
||||
// console.log('drupalSettings', drupalSettings)
|
||||
// console.log('window.location.origin', window.location.origin)
|
||||
|
||||
export const REST = axios.create({
|
||||
const REST = axios.create({
|
||||
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
@@ -13,3 +13,19 @@ export const REST = axios.create({
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
REST.interceptors.response.use(
|
||||
response => {
|
||||
return Promise.resolve(response)
|
||||
},
|
||||
error => {
|
||||
const { status } = error.response
|
||||
console.warn('error in rest-axios', status)
|
||||
if (status === 403) {
|
||||
window.location = '/'
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export default REST
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<script>
|
||||
import SearchForm from 'vuejs/components/Form/SearchForm'
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
|
||||
export default {
|
||||
props: ['blockid', 'formhtml'],
|
||||
|
@@ -9,7 +9,7 @@ import { mapState, mapActions } from 'vuex'
|
||||
import LoginBlock from 'vuejs/components/Block/LoginBlock'
|
||||
import UserTools from 'vuejs/components/User/UserTools'
|
||||
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
|
||||
export default {
|
||||
props: ['title', 'loginblock'],
|
||||
|
@@ -23,7 +23,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import router from 'vuejs/route'
|
||||
|
||||
let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
|
||||
|
@@ -4,7 +4,7 @@ import Vue from 'vue'
|
||||
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
import router from 'vuejs/route'
|
||||
|
||||
export default {
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
import router from 'vuejs/route'
|
||||
|
||||
import FlagCollection from 'vuejs/components/User/FlagCollection'
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
import router from 'vuejs/route'
|
||||
|
||||
export default {
|
||||
|
@@ -301,8 +301,8 @@ import LinkedMaterialCard from 'vuejs/components/Content/LinkedMaterialCard'
|
||||
|
||||
import cardMixins from 'vuejs/components/cardMixins'
|
||||
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
import { MGQ } from 'vuejs/api/graphql-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
import MGQ from 'vuejs/api/graphql-axios'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import gql from 'graphql-tag'
|
||||
import materiauFields from 'vuejs/api/gql/materiaumodal.fragment.gql'
|
||||
|
@@ -16,7 +16,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import router from 'vuejs/route'
|
||||
|
||||
let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
import Vue from 'vue'
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
|
||||
export default {
|
||||
name: "LoginForm",
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
import Vue from 'vue'
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
|
||||
import passwordStrength from 'check-password-strength'
|
||||
|
||||
|
@@ -118,9 +118,9 @@
|
||||
import router from 'vuejs/route'
|
||||
import store from 'vuejs/store'
|
||||
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
import { MGQ } from 'vuejs/api/graphql-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
import MGQ from 'vuejs/api/graphql-axios'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import gql from 'graphql-tag'
|
||||
// import materiauFields from 'vuejs/api/gql/materiau.fragment.gql'
|
||||
|
@@ -29,9 +29,9 @@
|
||||
import router from 'vuejs/route'
|
||||
import store from 'vuejs/store'
|
||||
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
import { MGQ } from 'vuejs/api/graphql-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
import MGQ from 'vuejs/api/graphql-axios'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import gql from 'graphql-tag'
|
||||
// import materiauFields from 'vuejs/api/gql/materiau.fragment.gql'
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// https://forum.vuejs.org/t/how-to-use-helper-functions-for-imported-modules-in-vuejs-vue-template/6266/5
|
||||
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
import Modal from 'vuejs/components/Helper/Modal'
|
||||
import LoginRegister from 'vuejs/components/Helper/LoginRegister'
|
||||
import { mapState } from 'vuex'
|
||||
|
@@ -3,10 +3,10 @@ import Vuex from 'vuex'
|
||||
|
||||
import { createStore } from 'vuex-extensions'
|
||||
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
// import qs from 'querystring-es3'
|
||||
|
||||
import { MGQ } from 'vuejs/api/graphql-axios'
|
||||
import MGQ from 'vuejs/api/graphql-axios'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import gql from 'graphql-tag'
|
||||
// import materiauFields from 'vuejs/api/gql/materiau.fragment.gql'
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
// import { MA } from 'vuejs/api/ma-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
// import MA from 'vuejs/api/ma-axios'
|
||||
// import qs from 'querystring-es3'
|
||||
|
||||
export default {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// import { REST } from 'vuejs/api/rest-axios'
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
// import REST from 'vuejs/api/rest-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
// import qs from 'querystring-es3'
|
||||
|
||||
export default {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
|
||||
import { MGQ } from 'vuejs/api/graphql-axios'
|
||||
import MGQ from 'vuejs/api/graphql-axios'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import gql from 'graphql-tag'
|
||||
import productsGQL from 'vuejs/api/gql/products.fragment.gql'
|
||||
|
@@ -1,11 +1,11 @@
|
||||
// import { REST } from 'vuejs/api/rest-axios'
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
// import REST from 'vuejs/api/rest-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
import qs from 'querystring-es3'
|
||||
|
||||
import Vue from 'vue'
|
||||
|
||||
import { MGQ } from 'vuejs/api/graphql-axios'
|
||||
import MGQ from 'vuejs/api/graphql-axios'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import gql from 'graphql-tag'
|
||||
import searchresultGQL from 'vuejs/api/gql/searchresults.fragment.gql'
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
// import { MA } from 'vuejs/api/ma-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
// import MA from 'vuejs/api/ma-axios'
|
||||
// import qs from 'querystring-es3'
|
||||
|
||||
export default {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { REST } from 'vuejs/api/rest-axios'
|
||||
// import { JSONAPI } from 'vuejs/api/json-axios'
|
||||
import { MA } from 'vuejs/api/ma-axios'
|
||||
import REST from 'vuejs/api/rest-axios'
|
||||
// import JSONAPI from 'vuejs/api/json-axios'
|
||||
import MA from 'vuejs/api/ma-axios'
|
||||
import qs from 'querystring-es3'
|
||||
|
||||
import materiauGQL from 'vuejs/api/gql/materiauflaglist.fragment.gql'
|
||||
@@ -46,7 +46,7 @@ export default {
|
||||
// state.username = data.username;
|
||||
state.mail = data.current_user.mail
|
||||
state.csrf_token = data.csrf_token
|
||||
state.isloggedin = true
|
||||
// state.isloggedin = true
|
||||
state.logout_token = data.logout_token
|
||||
},
|
||||
setLoginMessage (state, message) {
|
||||
@@ -64,6 +64,8 @@ export default {
|
||||
setUser (state, data) {
|
||||
state.mail = data.mail[0].value
|
||||
state.uuid = data.uuid[0].value
|
||||
// with session_limit, only here we are certain that the user is logged
|
||||
state.isloggedin = true
|
||||
},
|
||||
setRoles (state, roles) {
|
||||
console.log('User setRoles', roles)
|
||||
@@ -235,6 +237,7 @@ export default {
|
||||
.then(({ data }) => {
|
||||
console.log('user REST getUser data', data)
|
||||
console.log('roles', data.roles)
|
||||
// with session_limit, only here we are certain that the user is logged
|
||||
commit('setUser', data)
|
||||
if (data.roles) {
|
||||
commit('setRoles', data.roles)
|
||||
|
Reference in New Issue
Block a user