Skip to content

Commit

Permalink
chore: debugging deployment issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chengpeiquan committed Oct 29, 2024
1 parent 03db4bf commit 249e1e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
13 changes: 9 additions & 4 deletions src/app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { getContentCache } from '@/cache/content-cache'
import { type ListFolder } from '@/config/content-config'
import { type Locale } from '@/config/locale-config'

export async function POST(req: Request) {
export async function GET(req: Request) {
try {
const body = await req.json()
const url = new URL(req.url)
const params = new URLSearchParams(url.search)

console.log('-----')
console.log(body)
console.log(params)
console.log('-----')

const { folder, locale } = body
const folder = params.get('folder') as ListFolder
const locale = params.get('locale') as Locale

const data = await getContentCache(folder, locale)
console.log('-----')
Expand Down
17 changes: 10 additions & 7 deletions src/core/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ export const getSearchEngine = async (folder: ListFolder, locale: Locale) => {
if (engine) return engine

// const data = await getContentCache(...args)
const res = await fetch('https://chengpeiquan.com/api/search', {
method: 'POST',
body: JSON.stringify({
folder: 'article',
locale: 'zh',
}),
})
// const res = await fetch('https://chengpeiquan.com/api/search', {
// method: 'POST',
// body: JSON.stringify({
// folder: 'article',
// locale: 'zh',
// }),
// })
const res = await fetch(
'https://chengpeiquan.com/api/search?folder=article&locale=zh',
)
// @ts-ignore
const data = res.data
const instance = await initializeEngine(data)
Expand Down

0 comments on commit 249e1e2

Please sign in to comment.