File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
apps/bplan-client/src/routes/(main-layout)/preset Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5,25 +5,25 @@ const getSelfUrl = () => {
55 return import . meta. env . VITE_API_URL ?? 'http://localhost:3000'
66}
77const getPreset = query ( async ( id ?: string ) => {
8+ 'use server'
9+
810 if ( ! id ) {
911 return
1012 }
1113
12- const preset = await fetch ( `${ getSelfUrl ( ) } /api/preset/${ id } ` ) . then ( ( res ) => {
14+ return fetch ( `${ getSelfUrl ( ) } /api/preset/${ id } ` ) . then ( ( res ) => {
1315 if ( res . ok ) {
1416 return res . json ( )
1517 }
1618
1719 return { musics : [ ] , title : 'Unknown' }
1820 } )
19-
20- return preset
2121} , 'preset' )
2222
2323export default function PresetPage ( ) {
2424 const params = useParams ( )
25- // const preset = createAsync(() => getPreset(params.id))
26- const preset = ( ) => ( { musics : [ ] , title : 'test' } )
25+ const preset = createAsync ( ( ) => getPreset ( params . id ) )
26+ // const preset = () => ({musics: [], title: 'test'})
2727
2828 return < HomePage presetTitle = { preset ( ) ?. title } initMusics = { preset ( ) ?. musics } />
2929}
You can’t perform that action at this time.
0 commit comments