fixed gql api file: ->url() replaced by ->createFileUrl()

This commit is contained in:
Bachir Soussi Chiadmi 2022-02-22 11:04:16 +01:00
parent f7657c296e
commit 96b343b246
8 changed files with 16 additions and 13 deletions

View File

@ -1046,7 +1046,10 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
protected function addFile(ResolverRegistryInterface $registry, ResolverBuilder $builder) { protected function addFile(ResolverRegistryInterface $registry, ResolverBuilder $builder) {
$registry->addFieldResolver('File', 'url', $registry->addFieldResolver('File', 'url',
$builder->callback(function ($parent, $args) { $builder->callback(function ($parent, $args) {
return $parent->url(); // $fileuri = $parent->getFileUri();
$url = $parent->createFileUrl();
// return $parent->url();
return $url;
}) })
); );

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
fragment MateriauFields on Materiau { fragment MateriauFlagListFields on Materiau {
id id
title title
path path

View File

@ -1,4 +1,4 @@
fragment MateriauFields on Materiau { fragment MateriauModalFields on Materiau {
id id
title title
short_description short_description

View File

@ -1,4 +1,4 @@
fragment MateriauFields on Materiau { fragment MateriauSearchFields on Materiau {
id id
title title
short_description short_description

View File

@ -305,7 +305,7 @@ 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 { print } from 'graphql/language/printer'
import gql from 'graphql-tag' import gql from 'graphql-tag'
import materiauFields from 'vuejs/api/gql/materiaumodal.fragment.gql' import materiauModalFields from 'vuejs/api/gql/materiaumodal.fragment.gql'
const prettyBytes = require('pretty-bytes') const prettyBytes = require('pretty-bytes')
@ -404,10 +404,10 @@ export default {
this.loading = true this.loading = true
const ast = gql`{ const ast = gql`{
materiau(id: ${this.item.id}, lang: "${drupalDecoupled.lang_code}") { materiau(id: ${this.item.id}, lang: "${drupalDecoupled.lang_code}") {
...MateriauFields ...MateriauModalFields
} }
} }
${materiauFields} ${materiauModalFields}
` `
MGQ.post('', { query: print(ast) MGQ.post('', { query: print(ast)
}) })

View File

@ -3,7 +3,7 @@ import REST from 'vuejs/api/rest-axios'
import MA from 'vuejs/api/ma-axios' import MA from 'vuejs/api/ma-axios'
import qs from 'querystring-es3' import qs from 'querystring-es3'
import materiauGQL from 'vuejs/api/gql/materiauflaglist.fragment.gql' import materiauFlaglistGQL from 'vuejs/api/gql/materiauflaglist.fragment.gql'
// import router from 'vuejs/route' // this is not working // import router from 'vuejs/route' // this is not working
@ -331,7 +331,7 @@ export default {
if (state.flagcolls[collid].items.length) { if (state.flagcolls[collid].items.length) {
dispatch('loadMaterialsGQL', { dispatch('loadMaterialsGQL', {
ids: state.flagcolls[collid].items, ids: state.flagcolls[collid].items,
gqlfragment: materiauGQL, gqlfragment: materiauFlaglistGQL,
callBack: 'loadMaterialsCallBack', callBack: 'loadMaterialsCallBack',
callBackArgs: { collid: collid } callBackArgs: { collid: collid }
}).then(() => { }).then(() => {
@ -369,7 +369,7 @@ export default {
dispatch('loadMaterialsGQL', { dispatch('loadMaterialsGQL', {
ids: state.flagcolls[collid].items, ids: state.flagcolls[collid].items,
gqlfragment: materiauGQL, gqlfragment: materiauFlaglistGQL,
callBack: 'loadMaterialsCallBack', callBack: 'loadMaterialsCallBack',
callBackArgs: { collid: collid } callBackArgs: { collid: collid }
}) })