File tree Expand file tree Collapse file tree 2 files changed +14
-20
lines changed Expand file tree Collapse file tree 2 files changed +14
-20
lines changed Original file line number Diff line number Diff line change @@ -218,19 +218,16 @@ function loadProjectList(id) {
218
218
color,
219
219
name,
220
220
resources,
221
- projects[]-> {
221
+ " projects": *[_type == "project" && references(^._id)] | order(projectNumber) {
222
222
title,
223
- _id,
224
- }
223
+ _id
224
+ }
225
225
}[0]
226
226
` ) ;
227
227
let PROJECT_URL = `https://${ PROJECT_ID } .api.sanity.io/v2021-10-21/data/query/${ DATASET } ?query=${ PROJECTS_QUERY } `
228
228
fetch ( PROJECT_URL )
229
229
. then ( response => response . json ( ) )
230
- . then ( data => {
231
- console . log ( data ) ;
232
- populate ( data . result , id ) ;
233
- } )
230
+ . then ( data => populate ( data . result , id ) )
234
231
235
232
function populate ( data , id ) {
236
233
if ( document . querySelector ( '.td-project-list .loader' ) ) {
@@ -336,10 +333,10 @@ tdList.addEventListener('click', e => {
336
333
*[_type == "project" && _id == "${ id } "]{
337
334
_id,
338
335
title,
339
- gradingSections[]-> |order(order){
336
+ " gradingSections": *[_type == "gradingSection" && references(^._id)] |order(order){
340
337
title,
341
338
_id,
342
- requirements[]-> |order(order){
339
+ " requirements": *[_type == "requirement" && references(^._id)] |order(order){
343
340
title,
344
341
_id,
345
342
isExceeds,
@@ -351,7 +348,7 @@ tdList.addEventListener('click', e => {
351
348
fetch ( SINGLE_PROJECT_URL )
352
349
. then ( response => response . json ( ) )
353
350
. then ( data => {
354
- console . log ( data ) ;
351
+ console . log ( data . result ) ;
355
352
loadProjectRequirements ( data . result ) ;
356
353
} )
357
354
}
Original file line number Diff line number Diff line change @@ -218,19 +218,16 @@ function loadProjectList(id) {
218
218
color,
219
219
name,
220
220
resources,
221
- projects[]-> {
221
+ " projects": *[_type == "project" && references(^._id)] | order(projectNumber) {
222
222
title,
223
- _id,
224
- }
223
+ _id
224
+ }
225
225
}[0]
226
226
` ) ;
227
227
let PROJECT_URL = `https://${ PROJECT_ID } .api.sanity.io/v2021-10-21/data/query/${ DATASET } ?query=${ PROJECTS_QUERY } `
228
228
fetch ( PROJECT_URL )
229
229
. then ( response => response . json ( ) )
230
- . then ( data => {
231
- console . log ( data ) ;
232
- populate ( data . result , id ) ;
233
- } )
230
+ . then ( data => populate ( data . result , id ) )
234
231
235
232
function populate ( data , id ) {
236
233
if ( document . querySelector ( '.td-project-list .loader' ) ) {
@@ -336,10 +333,10 @@ tdList.addEventListener('click', e => {
336
333
*[_type == "project" && _id == "${ id } "]{
337
334
_id,
338
335
title,
339
- gradingSections[]-> |order(order){
336
+ " gradingSections": *[_type == "gradingSection" && references(^._id)] |order(order){
340
337
title,
341
338
_id,
342
- requirements[]-> |order(order){
339
+ " requirements": *[_type == "requirement" && references(^._id)] |order(order){
343
340
title,
344
341
_id,
345
342
isExceeds,
@@ -351,7 +348,7 @@ tdList.addEventListener('click', e => {
351
348
fetch ( SINGLE_PROJECT_URL )
352
349
. then ( response => response . json ( ) )
353
350
. then ( data => {
354
- console . log ( data ) ;
351
+ console . log ( data . result ) ;
355
352
loadProjectRequirements ( data . result ) ;
356
353
} )
357
354
}
You can’t perform that action at this time.
0 commit comments