-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from ddxv/broken-ios-search
Broken ios search
- Loading branch information
Showing
6 changed files
with
66 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 31 additions & 18 deletions
49
frontend/src/routes/developers/[developer]/+page.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,43 @@ | ||
export const ssr: boolean = true; | ||
export const csr: boolean = false; | ||
import type { PageServerLoad } from './$types.js'; | ||
|
||
import type { AppGroup, DeveloperResponse } from '../../../types.js'; | ||
export const ssr: boolean = true; | ||
export const csr: boolean = true; | ||
|
||
console.log('Script executed'); | ||
|
||
/** @type {import('../[developer]/$types').PageServerLoad} */ | ||
export async function load({ params }): Promise<DeveloperResponse> { | ||
export const load: PageServerLoad = async ({ params, locals }) => { | ||
const developerValue = params.developer; | ||
console.log(`load started collection=${developerValue}`); | ||
const res = fetch(`http://localhost:8000/api/apps/developers/${developerValue}`); | ||
console.log(`load started developer=${developerValue}`); | ||
try { | ||
const res = await fetch(`http://localhost:8000/api/apps/developers/${developerValue}`); | ||
|
||
if (!res.ok) { | ||
const text = await res.text(); | ||
throw new Error(`Failed to fetch developers status ${res.status} ${text}`); | ||
} | ||
|
||
const app_collections: AppGroup = await res.json(); | ||
console.log(`loaded developers with len: ${Object.keys(app_collections).length}`); | ||
return { results: app_collections }; | ||
return { | ||
results: { | ||
streamed: res | ||
.then((resp) => { | ||
if (resp.status === 200) { | ||
return resp.json(); | ||
} else if (resp.status === 404) { | ||
console.log('App Not found'); | ||
return 'App Not Found'; | ||
} else if (resp.status === 500) { | ||
console.log('API Server error'); | ||
return 'Backend Error'; | ||
} | ||
}) | ||
.then( | ||
(json) => json, | ||
(error) => { | ||
console.log('Uncaught error', error); | ||
return 'Uncaught Error'; | ||
} | ||
) | ||
} | ||
}; | ||
} catch (error) { | ||
console.error('Failed to load data:', error); | ||
return { | ||
results: { streamed: {} }, | ||
status: 500, | ||
error: 'Failed to load trending apps' | ||
}; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters