latex-lsp/languagetool.ts

23 lines
606 B
TypeScript

export async function add_personal(words: string[]): Promise<void> {
console.log("adding " + JSON.stringify({ words }));
try {
const res = await fetch('https://api.languagetoolplus.com/enterprise/v1/dictionary/words?type=personal', {
method: 'POST',
headers: {
'Accept': 'application/json',
'authorization': process.env.AUTHORIZATION_MY_LTEX ?? '',
'content-type': 'application/json',
},
body: JSON.stringify({
words
}),
});
console.log(await res.text());
} catch (e) {
console.log("got error:" + e);
throw e;
}
}