latex-lsp/languagetool.ts

23 lines
606 B
TypeScript
Raw Normal View History

2023-12-31 15:33:43 +00:00
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',
2024-02-29 15:39:13 +00:00
'authorization': process.env.AUTHORIZATION_MY_LTEX ?? '',
2023-12-31 15:33:43 +00:00
'content-type': 'application/json',
},
body: JSON.stringify({
words
}),
});
console.log(await res.text());
} catch (e) {
console.log("got error:" + e);
throw e;
}
}