Migrate to Vite

This commit is contained in:
Karolis2011
2022-01-25 22:05:37 +02:00
parent df48e88614
commit 0b19ee33a8
15 changed files with 806 additions and 13613 deletions

View File

@@ -1,5 +1,4 @@
import * as msal from '@azure/msal-browser'
import Cookies from 'cookies-js'
import axios from 'axios'
const ClientIdCookieName = 'ktusakacas'
@@ -122,23 +121,8 @@ function __stateChanged() {
msalState.stateChangeCallbacks.forEach(cb => cb())
}
function __isLocalStorageAvailable() {
try {
localStorage.setItem('__lsTest', 'true')
const result = localStorage.getItem('__lsTest')
localStorage.removeItem('__lsTest')
return result == 'true'
} catch (e) {
return false
}
}
async function __loadAuthParameters() {
if (__isLocalStorageAvailable()) {
await __loadAuthParametersLocalStorage()
} else {
await __loadAuthParametersCookies()
}
await __loadAuthParametersLocalStorage()
}
async function __loadAuthParametersLocalStorage() {
@@ -157,22 +141,6 @@ async function __loadAuthParametersLocalStorage() {
}
}
async function __loadAuthParametersCookies() {
const clientId = Cookies.get(ClientIdCookieName)
const authority = Cookies.get(AuthorityCookieName)
const tenant = Cookies.get(TenantCookieName)
if (clientId == null || authority == null || tenant == null) {
await __fetchAuthParameters()
Cookies.set(ClientIdCookieName, msalState.clientId)
Cookies.set(AuthorityCookieName, msalState.authority)
Cookies.set(TenantCookieName, msalState.tenant)
} else {
msalState.clientId = clientId
msalState.authority = authority
msalState.tenant = tenant
}
}
async function __fetchAuthParameters() {
var response = await axios.get('/api/AuthMetadata')
msalState.clientId = response.data.clientId