displaying fields labels
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
// import REST from '@api/rest-axios'
|
||||
// import JSONAPI from '@api/json-axios'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
@@ -9,13 +11,15 @@ import GQL from '@api/graphql-axios'
|
||||
// import JSONAPI from '@api/json-axios'
|
||||
|
||||
import ConcernementFields from '@api/gql/concernement.fragment.gql'
|
||||
// import EntityFields from '@api/gql/entitydef.fragment.gql'
|
||||
|
||||
export const ConcernementsStore = defineStore({
|
||||
id: 'concernements',
|
||||
state: () => ({
|
||||
concernements: [],
|
||||
concernementsByID: {},
|
||||
opened: false
|
||||
opened: false,
|
||||
ct_concernement: {}
|
||||
}),
|
||||
getters: {
|
||||
|
||||
@@ -46,6 +50,30 @@ export const ConcernementsStore = defineStore({
|
||||
})
|
||||
})
|
||||
},
|
||||
loadContentTypeDefinition () {
|
||||
const body = {
|
||||
query: `
|
||||
query EntityDef($type: String!, $bundle: String!){
|
||||
entitydef(type: $type, bundle: $bundle) {
|
||||
fields {
|
||||
type
|
||||
field_name
|
||||
label
|
||||
description
|
||||
}
|
||||
}
|
||||
}`,
|
||||
variables: { type: 'node', bundle: 'concernement' }
|
||||
}
|
||||
GQL.post('', body)
|
||||
.then(({ data: { data: { entitydef }}}) => {
|
||||
console.log('loadContentTypeDefinition entitydef', entitydef);
|
||||
entitydef.fields.forEach(field => {
|
||||
this.ct_concernement[field.field_name] = field;
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
openCloseConcernement (id, state) {
|
||||
// console.log('openCloseConcernement', id, state);
|
||||
this.concernementsByID[id].opened = state;
|
||||
|
Reference in New Issue
Block a user