File tree Expand file tree Collapse file tree
apps/codingcatdev/src/routes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7676 </section >
7777 {#if next }
7878 <div class =" flex justify-center m-8" >
79- <button class ="text-2xl btn btn-lg btn-primary" on:click ={() => more ()}> More </button >
79+ <button class ="text-2xl bcu-button variant-filled-primary" on:click ={() => more ()}>
80+ Show More
81+ </button >
8082 </div >
8183 {/if }
8284 </div >
Original file line number Diff line number Diff line change 1- import { listContent } from '$lib/server/content' ;
1+ import { listContent , parseModules } from '$lib/server/content' ;
2+ import { ContentType } from '$lib/types' ;
23import type { RequestHandler } from '@sveltejs/kit' ;
34
45export const POST : RequestHandler = async ( { request } ) => {
56 const { contentType, after } = await request . json ( ) ;
6- const content = await listContent ( { contentType, after } ) ;
7- return new Response ( String ( JSON . stringify ( content ) ) ) ;
7+ let modules ;
8+ switch ( contentType ) {
9+ case ContentType . course :
10+ modules = import . meta. glob ( [ '../../../content/course/*.md' ] ) ;
11+ break ;
12+ case ContentType . framework :
13+ modules = import . meta. glob ( [ '../../../content/framework/*.md' ] ) ;
14+ break ;
15+ case ContentType . language :
16+ modules = import . meta. glob ( [ '../../../content/language/*.md' ] ) ;
17+ break ;
18+ case ContentType . podcast :
19+ modules = import . meta. glob ( [ '../../../content/podcast/*.md' ] ) ;
20+ break ;
21+ case ContentType . post :
22+ modules = import . meta. glob ( [ '../../../content/post/*.md' ] ) ;
23+ break ;
24+ case ContentType . tutorial :
25+ modules = import . meta. glob ( [ '../../../content/tutorial/*.md' ] ) ;
26+ break ;
27+ }
28+
29+ if ( ! modules ) {
30+ return new Response ( String ( JSON . stringify ( {
31+ contentType,
32+ contentItems : [ ]
33+ } ) ) ) ;
34+ }
35+
36+ const contentItems = await parseModules ( modules ) ;
37+ return new Response ( String ( JSON . stringify ( {
38+ contentType,
39+ ...( await listContent ( { contentItems, after } ) )
40+ } ) ) ) ;
841} ;
You can’t perform that action at this time.
0 commit comments