refactor: everything except product page
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import * as Carousel from '$lib/components/ui/carousel'
|
||||
import { Badge, type BadgeVariant } from '$lib/components/ui/badge'
|
||||
import { Separator } from '$lib/components/ui/separator'
|
||||
import ColorVariations from '$lib/components/ui/variations/ColorVariations.svelte'
|
||||
@@ -17,12 +16,6 @@
|
||||
import type { ImageCarouselItem } from '$lib/components/ui/image-carousel'
|
||||
import { ShopList, type TShopListItem } from '$lib/components/ui/shopList'
|
||||
|
||||
async function crawlClevertronik() {
|
||||
const response = await fetch('/crawl', { method: 'POST' })
|
||||
const productName = await response.json()
|
||||
console.log(productName)
|
||||
}
|
||||
|
||||
type ProductBadge = {
|
||||
text: string
|
||||
variant: BadgeVariant
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { crawlClevertronik } from '$lib/server/crawler/clevertronik'
|
||||
import { json, error } from '@sveltejs/kit'
|
||||
import { Effect } from 'effect'
|
||||
|
||||
export async function POST() {
|
||||
try {
|
||||
const pageContent = await Effect.runPromise(
|
||||
crawlClevertronik.pipe(Effect.annotateLogs({ route: 'crawl' })),
|
||||
)
|
||||
return json(pageContent)
|
||||
} catch (e) {
|
||||
if (
|
||||
e &&
|
||||
typeof e === 'object' &&
|
||||
'message' in e &&
|
||||
typeof e.message === 'string'
|
||||
) {
|
||||
return error(500, { message: e.message })
|
||||
}
|
||||
return error(500, { message: 'Internal Error' })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user