Skip to content

Commit

Permalink
Merge pull request #18 from gdi-be/search-index-proxy
Browse files Browse the repository at this point in the history
Proxy for the search reindex interface
  • Loading branch information
KaiVolland authored Jan 20, 2025
2 parents 1b1d324 + a5c272e commit e9b8f1f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/routes/search/index/initialize/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { env } from "$env/dynamic/private";
import { error } from '@sveltejs/kit';
import { getAccessToken } from '$lib/auth/cookies.js';

/** @type {import('./$types').RequestHandler} */
export async function GET({ cookies, fetch }) {

const token = await getAccessToken(cookies);
if (!token) return error(401, 'Unauthorized');

const headers = new Headers({
Authorization: `Bearer ${token}`
});

const response = await fetch(`${env.BACKEND_URL}/search/index/initialize`, {
headers
});

return response;
}

0 comments on commit e9b8f1f

Please sign in to comment.