fix: 🐛 fix for iOS
This commit is contained in:
parent
30b5bbb51e
commit
8e3a9c1390
|
@ -170,7 +170,7 @@ export class ApiSkolplattformen extends EventEmitter implements Api {
|
|||
|
||||
public async loginFreja(): Promise<FrejaLoginStatusChecker> {
|
||||
|
||||
await this.clearSession()
|
||||
// await this.clearSession()
|
||||
|
||||
const loginUrl = routes.frejaLogin
|
||||
const loginResponse = await this.fetch('auth-ticket', loginUrl)
|
||||
|
@ -244,10 +244,7 @@ export class ApiSkolplattformen extends EventEmitter implements Api {
|
|||
|
||||
try{
|
||||
const url = routes.frejaReturnUrl
|
||||
const session = await this.getSession(url, {
|
||||
redirect: 'manual',
|
||||
})
|
||||
await this.fetch('freja-login-return-url', url, session)
|
||||
await this.fetch('freja-login-return-url', url)
|
||||
} catch(error){
|
||||
console.log(JSON.stringify(error))
|
||||
}
|
||||
|
@ -257,12 +254,12 @@ export class ApiSkolplattformen extends EventEmitter implements Api {
|
|||
const session = await this.getSession(url2, {
|
||||
redirect: 'manual',
|
||||
})
|
||||
await this.fetch('freja-login-cookie', url2, session)
|
||||
await this.fetch('freja-login-cookie', url2)
|
||||
} catch(error2){
|
||||
console.log(JSON.stringify(error2))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async retrieveXsrfToken(): Promise<void> {
|
||||
const url = routes.hemPage
|
||||
const session = this.getRequestInit()
|
||||
|
|
|
@ -6,22 +6,22 @@ export class FrejaChecker extends EventEmitter implements FrejaLoginStatusChecke
|
|||
|
||||
private fetcher: Fetcher
|
||||
private url: string
|
||||
private session: RequestInit
|
||||
|
||||
private cancelled = false;
|
||||
|
||||
constructor(fetcher: Fetcher, token: string, session: RequestInit) {
|
||||
constructor(fetcher: Fetcher, token: string) {
|
||||
super();
|
||||
this.fetcher = fetcher
|
||||
this.session = session
|
||||
|
||||
this.token = token
|
||||
this.url = frejaLoginStatus;
|
||||
this.check();
|
||||
}
|
||||
|
||||
async check(): Promise<void> {
|
||||
const response = await this.fetcher('freja-login-status', this.url, this.session);
|
||||
const response = await this.fetcher('freja-login-status', this.url);
|
||||
const status = await response.text();
|
||||
console.log(status)
|
||||
this.emit(status);
|
||||
if (!this.cancelled &&
|
||||
status !== 'APPROVED' &&
|
||||
|
@ -30,7 +30,6 @@ export class FrejaChecker extends EventEmitter implements FrejaLoginStatusChecke
|
|||
){
|
||||
setTimeout(() => this.check(), 1000);
|
||||
}
|
||||
else console.log('APPROVED');
|
||||
}
|
||||
|
||||
async cancel(): Promise<void> {
|
||||
|
@ -43,5 +42,5 @@ export class FrejaChecker extends EventEmitter implements FrejaLoginStatusChecke
|
|||
fetch: Fetcher,
|
||||
token: string,
|
||||
session: RequestInit
|
||||
): FrejaLoginStatusChecker => new FrejaChecker(fetch, token, session)
|
||||
): FrejaLoginStatusChecker => new FrejaChecker(fetch, token)
|
||||
|
Loading…
Reference in New Issue