make env.xsrfToken lazy loading

- remove env.envKey
This commit is contained in:
2025-09-19 14:58:14 +02:00
parent 877c88d52b
commit c38a50af34
3 changed files with 6 additions and 5 deletions

View File

@@ -1,12 +1,14 @@
//#region parameters
const env = Object.freeze({
xsrfToken: document.getElementsByName('__RequestVerificationToken')[0].value,
envKey: document.querySelector('meta[name="env-key"]').getAttribute('content')
__lazyXsrfToken: new Lazy(() => document.getElementsByName('__RequestVerificationToken')[0].value),
get xsrfToken() {
return this.__lazyXsrfToken.value;
}
})
const url = Object.freeze({
reject: `/api/annotation/reject`,
rejectRedir: `/envelope/${env.envKey}`,
rejectRedir: `/envelope/${ENV_KEY}`,
share: `/api/readonly`
});
//#endregion