remove setLangAsync-method
This commit is contained in:
parent
660a4c24df
commit
7bc6cc92a0
@ -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', {
|
||||
|
||||
@ -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}
|
||||
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}
|
||||
Loading…
x
Reference in New Issue
Block a user