language-learning-app/frontend/src/routes/app/admin/dictionary-search/dictionarySearch.remote.ts
wilson 45336277df
Some checks failed
/ test (push) Has been cancelled
feat: [frontend] Refactor the packs admin interface
2026-04-17 09:39:42 +01:00

20 lines
605 B
TypeScript

import { query, getRequestEvent } from '$app/server';
import * as v from 'valibot';
import { searchWordformsApiDictionaryWordformsGet } from '../../../../client';
import { COOKIE_NAME_AUTH_TOKEN } from '$lib/auth';
export const dictionarySearch = query(
v.object({
text: v.string(),
langCode: v.string()
}),
async ({ langCode, text }) => {
const { cookies } = getRequestEvent();
const { data } = await searchWordformsApiDictionaryWordformsGet({
headers: { Authorization: `Bearer ${cookies.get(COOKIE_NAME_AUTH_TOKEN)}` },
query: { lang_code: langCode, text }
});
return data;
}
);