Hi,
In my slice, I want to retrieve all the "clubs" (customtype : clubcustomtype) which the field "niveaulabellisation" is equal to 1
If I don't filter on the "niveaulabellisation", everything works fine :
async fetch() {
try {
let localeForPrismic = 'fr-fr'
if (this.$i18n.locale === 'en') {
localeForPrismic = 'en-us'
}const clubs = await this.$prismic.api.query( [ this.$prismic.predicates.at('document.type', 'clubcustomtype'), ], { lang: localeForPrismic, orderings: '[my.clubcustomtype.datelabellisation desc]', pageSize: 2, page: this.pageNumber, } ) this.clubs = clubs } catch (e) { console.error(e) }
},
But When I add the filter :
async fetch() {
try {
let localeForPrismic = 'fr-fr'
if (this.$i18n.locale === 'en') {
localeForPrismic = 'en-us'
}const clubs = await this.$prismic.api.query( [ this.$prismic.predicates.at('document.type', 'clubcustomtype'), this.$prismic.predicates.at( 'my.clubcustomtype.niveaulabellisation', 1 ), ], { lang: localeForPrismic, orderings: '[my.clubcustomtype.datelabellisation desc]', pageSize: 2, page: this.pageNumber, } ) // my.club.niveaulabellisation this.clubs = clubs } catch (e) { console.error(e) }
},
Primic API returns an error :
https://fairplayforplanet.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=2&lang=fr-fr&orderings=[my.clubcustomtype.datelabellisation%20desc]&ref=ZBB2OhAAACoAzSpg&q=[[at(document.type%2C%20"clubcustomtype")][at(my.clubcustomtype.niveaulabellisation%2C%201)]]
Her is my customtype
{
"id": "clubcustomtype",
"label": "Club",
"repeatable": true,
"status": true,
"json": {
"Main": {
"logo": {
"type": "Image",
"config": {
"label": "logo",
"constraint": {
"width": 300
},
"thumbnails":
}
},
"nom": {
"type": "Text",
"config": {
"label": "nom",
"placeholder": ""
}
},
"scoretotal": {
"type": "Text",
"config": {
"label": "scoreTotal",
"placeholder": ""
}
},
"scorepreservationenvironnement": {
"type": "Text",
"config": {
"label": "scorePreservationEnvironnement",
"placeholder": ""
}
},
"scoreecoperformer": {
"type": "Text",
"config": {
"label": "scoreEcoperformer",
"placeholder": ""
}
},
"scorerolesocietal": {
"type": "Text",
"config": {
"label": "scoreRoleSocietal",
"placeholder": ""
}
},
"datelabellisation": {
"type": "Date",
"config": {
"label": "dateLabellisation",
"placeholder": ""
}
},
"niveaulabellisation": {
"type": "Select",
"config": {
"label": "niveauLabellisation",
"placeholder": "",
"options": [
"1",
"2",
"3"
]
}
},
"sport": {
"type": "Text",
"config": {
"label": "sport",
"placeholder": ""
}
}
}
}
}