diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.js b/EnvelopeGenerator.Web/wwwroot/js/network.js index 967893ea..d057b8fe 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.js @@ -25,17 +25,6 @@ function postEnvelope(annotations) { return fetch(`/api/annotation`, options) } -async function setLangAsync(language, flagCode) { - document.getElementById('selectedFlag').className = 'fi ' + flagCode + ' me-2'; - - await fetch(`/api/localization/lang/${language}`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - } - }) -} - async function setLanguage(language) { const hasLang = await fetch('/api/localization/lang', { diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.min.js b/EnvelopeGenerator.Web/wwwroot/js/network.min.js index 208197a3..50f09dd3 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.min.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.min.js @@ -1 +1 @@ -function getCsrfToken(){return{"X-XSRF-TOKEN":document.getElementsByName("__RequestVerificationToken")[0].value}}function postEnvelope(n){const t=getCsrfToken(),i={credentials:"include",method:"POST",headers:{...t,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(n)};return fetch(`/api/annotation`,i)}async function setLangAsync(n,t){document.getElementById("selectedFlag").className="fi "+t+" me-2";await fetch(`/api/localization/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}})}async function setLanguage(n){const t=await fetch("/api/localization/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/api/localization/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}async function getAnnotationParams(n=0,t=0,i=72){var f,r;const u=await fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json());for(f in u)r=u[f],r.width*=i,r.height*=i,r.left+=n-.7,r.left*=i,r.top+=t-.5,r.top*=i;return u} \ No newline at end of file +function getCsrfToken(){return{"X-XSRF-TOKEN":document.getElementsByName("__RequestVerificationToken")[0].value}}function postEnvelope(n){const t=getCsrfToken(),i={credentials:"include",method:"POST",headers:{...t,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(n)};return fetch(`/api/annotation`,i)}async function setLanguage(n){const t=await fetch("/api/localization/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/api/localization/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}async function getAnnotationParams(n=0,t=0,i=72){var f,r;const u=await fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json());for(f in u)r=u[f],r.width*=i,r.height*=i,r.left+=n-.7,r.left*=i,r.top+=t-.5,r.top*=i;return u} \ No newline at end of file