diff --git a/src/lib/components/pages/Home/Testimonial.svelte b/src/lib/components/pages/Home/Testimonial.svelte index 2bb8590..abc7f40 100644 --- a/src/lib/components/pages/Home/Testimonial.svelte +++ b/src/lib/components/pages/Home/Testimonial.svelte @@ -1,11 +1,26 @@ -
+
Trust that speak for itself
- + + {#await testimonial} +
+ {#each Array.from({ length: 10 })} + + {/each} +
+ {:then reviews} +
+ {#each reviews?.testimonial.slice(0, 4) as review} +
+ +
+ {/each} +
+ {/await}
diff --git a/src/lib/utils/api.ts b/src/lib/utils/api.ts index 9d2a83f..4ee242e 100644 --- a/src/lib/utils/api.ts +++ b/src/lib/utils/api.ts @@ -32,5 +32,9 @@ export const endpoints = { celebrity: '/products/celebrity', recommended: '/products/recommended', flashSale: '/products/flash-sales' + }, + testimonial: { + show: '/testimonial/', + create: '/testimonial/' } }; diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index b0b30f6..7da00eb 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -4,7 +4,7 @@ import type { PageServerLoad } from './$types'; export const load: PageServerLoad = async ({ fetch }) => { try { - const [banner, celebrity, newArival, trending] = await Promise.all([ + const [banner, celebrity, newArival, trending, testimonial] = await Promise.all([ fetch(`${VITE_BACKEND_URL}${endpoints.category.banner}`, { method: 'GET', headers: { @@ -32,6 +32,14 @@ export const load: PageServerLoad = async ({ fetch }) => { 'Content-Type': 'application/json', Accept: 'application/json' } + }), + + fetch(`${VITE_BACKEND_URL}${endpoints.testimonial.show}`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json' + } }) ]); @@ -46,7 +54,8 @@ export const load: PageServerLoad = async ({ fetch }) => { banner: banner.json(), // celebrity: celebrity.json(), newArrival: newArival.json(), - trending: trending.json() + trending: trending.json(), + testimonial: testimonial.json() }; } catch (err) { return { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 6e564ed..03e0259 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -41,7 +41,7 @@ {/if} {/await} - +
20 Years of Clinical Trust