From 1e8937bdc4d026183184f58b6d6fc6c0e551767d Mon Sep 17 00:00:00 2001 From: joel Date: Fri, 22 Nov 2024 13:50:49 -0800 Subject: [PATCH] fix: tag label name switcheroo --- src/lib/courses.ts | 4 ++-- src/lib/lessons.ts | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib/courses.ts b/src/lib/courses.ts index da95e13d3..2cdc420ee 100644 --- a/src/lib/courses.ts +++ b/src/lib/courses.ts @@ -28,8 +28,8 @@ const courseQuery = groq` "type": "lesson", "tags": softwareLibraries[] { ...(library->{ - name, - 'label': slug.current, + 'name': slug.current, + 'label': name, 'http_url': url, 'image_url': image.url }) diff --git a/src/lib/lessons.ts b/src/lib/lessons.ts index 9e79424fe..55a1fe76d 100644 --- a/src/lib/lessons.ts +++ b/src/lib/lessons.ts @@ -11,7 +11,6 @@ import { } from '@/utils/lesson-metadata' import compactedMerge from '@/utils/compacted-merge' import {convertUndefinedValuesToNull} from '@/utils/convert-undefined-values-to-null' -import fetchEggheadUser from '@/api/egghead/users/from-token' // code_url is only used in a select few Kent C. Dodds lessons const lessonQuery = groq` @@ -21,7 +20,6 @@ const lessonQuery = groq` 'slug': slug.current, description, ...resources[@->["_type"] == "videoResource"][0]->{ - "hls_url": mediaUrls.hlsUrl, "dash_url": mediaUrls.dashUrl, "media_url": mediaUrls.hlsUrl, "transcript": transcript.text, @@ -47,8 +45,8 @@ const lessonQuery = groq` }, 'tags': softwareLibraries[] { ...(library-> { - name, - 'label': slug.current, + 'name': slug.current, + 'label': name, 'http_url': url, 'image_url': image.url }), @@ -122,8 +120,6 @@ export async function loadLesson( ): Promise { token = token || getAccessTokenFromCookie() - const eggheadViewer = await fetchEggheadUser(token as string, true) - /****************************************** * Primary Lesson Metadata GraphQL Request * ****************************************/ @@ -132,6 +128,8 @@ export async function loadLesson( token, ) + console.log('lessonMetadataFromGraphQL', lessonMetadataFromGraphQL) + /********************************************** * Load comments from separate GraphQL Request * ********************************************/ @@ -145,6 +143,8 @@ export async function loadLesson( // this will be used to override values from graphql const lessonMetadataFromSanity = await loadLessonMetadataFromSanity(slug) + console.log('lessonMetadataFromSanity', lessonMetadataFromSanity) + /************************************* * Merge All Lesson Metadata Together * ***********************************/ @@ -156,6 +156,8 @@ export async function loadLesson( lessonMetadata = convertUndefinedValuesToNull(lessonMetadata) + console.log('lessonMetadata', lessonMetadata) + // if (!eggheadViewer.is_pro && !lessonMetadata.free_forever) { // delete lessonMetadata.hls_url // delete lessonMetadata.dash_url