|
@@ -1,5 +1,6 @@
|
|
|
-import qs from 'querystring'
|
|
|
-import { REST } from 'api/rest-axios'
|
|
|
+// import qs from 'querystring'
|
|
|
+// import { REST } from 'api/rest-axios'
|
|
|
+import { GRAPHQL } from 'api/graphql-axios'
|
|
|
|
|
|
export default {
|
|
|
namespaced: true,
|
|
@@ -124,19 +125,40 @@ export default {
|
|
|
actions: {
|
|
|
// async get authors
|
|
|
getProjects ({ dispatch, commit, state }) {
|
|
|
- let params = {
|
|
|
- _sort: `weight:ASC`
|
|
|
- }
|
|
|
- let q = qs.stringify(params)
|
|
|
- REST.get(`projects?` + q, {})
|
|
|
- .then(({ data }) => {
|
|
|
- console.log('projects getProjects REST: data', data)
|
|
|
- commit('setProjects', data)
|
|
|
+ // GRAPHQL
|
|
|
+ let query = `query {
|
|
|
+ projects {
|
|
|
+ id
|
|
|
+ Weight
|
|
|
+ Titre
|
|
|
+ }
|
|
|
+ }`
|
|
|
+ GRAPHQL.post('', { query: query })
|
|
|
+ .then((resp) => {
|
|
|
+ console.log('graphql projects', resp)
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
console.warn('Issue with getProjects', error)
|
|
|
Promise.reject(error)
|
|
|
})
|
|
|
+
|
|
|
+ // REST
|
|
|
+ // let params = {
|
|
|
+ // _sort: `weight:ASC`
|
|
|
+ // }
|
|
|
+ // let q = qs.stringify(params)
|
|
|
+ // REST.get(`projects?` + q, {})
|
|
|
+ // .then(({ data }) => {
|
|
|
+ // console.log('projects getProjects REST: data', data)
|
|
|
+ // commit('setProjects', data)
|
|
|
+ // })
|
|
|
+ // .catch((error) => {
|
|
|
+ // console.warn('Issue with getProjects', error)
|
|
|
+ // Promise.reject(error)
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ build3dBuilding ({ dispatch, commit, state }) {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|