Commit c05fd33b authored by Christopher Fullarton's avatar Christopher Fullarton

Fixes database closed error

parent c657e811
Pipeline #33612 passed with stages
in 14 minutes and 54 seconds
......@@ -36,7 +36,7 @@ export class AppDb extends Dexie {
};
sessionStorage.setItem(StorageKey.PrivateKey, privateKey.value);
this.Config.put(privateKey).then(() => this.initialized.next());
});
}).catch(() => {});
}
......
export interface ITrackClickEvent {
action: string;
label: string;
value?: number;
customDimensions?: any;
}
export interface ITrackConversionEvent {
action: string;
label?: string;
}
import { TrackingCategoryType } from '../../enums/enums';
export interface ITrackEvent {
action: string;
category: TrackingCategoryType;
label: string;
value?: number;
customDimensions?: any;
}
......@@ -17,6 +17,7 @@ import { MessageProtocol, StatusProtocol } from '../../lib/enums/Message';
import { QuestionType } from '../../lib/enums/QuestionType';
import { QuizState } from '../../lib/enums/QuizState';
import { UserRole } from '../../lib/enums/UserRole';
import { ITrackClickEvent } from '../../lib/interfaces/tracking/ITrackClickEvent';
import { AvailableQuizzesComponent } from '../../modals/available-quizzes/available-quizzes.component';
import { MemberApiService } from '../../service/api/member/member-api.service';
import { QuizApiService } from '../../service/api/quiz/quiz-api.service';
......@@ -31,7 +32,7 @@ import { SettingsService } from '../../service/settings/settings.service';
import { SharedService } from '../../service/shared/shared.service';
import { StorageService } from '../../service/storage/storage.service';
import { ThemesService } from '../../service/themes/themes.service';
import { ITrackClickEvent, TrackingService } from '../../service/tracking/tracking.service';
import { TrackingService } from '../../service/tracking/tracking.service';
import { UserService } from '../../service/user/user.service';
@Component({
......
......@@ -379,7 +379,6 @@ export class FooterBarService {
logout: true,
},
}, () => {
this.userService.logout();
});
public footerElemEditI18n: IFooterBarElement = new FooterbarElement({
id: 'edit-i18n',
......
......@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Observable, ReplaySubject, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { AppDb } from '../../lib/db/app.db';
import { DbName, DbState, StorageKey } from '../../lib/enums/enums';
import { DbState, StorageKey } from '../../lib/enums/enums';
@Injectable({
providedIn: 'root',
......@@ -24,7 +24,7 @@ export class StorageService {
return this._db.initialized;
}
return this.initDb(username || DbName.Default);
return this.initDb(username);
}
private initDb(dbName): Observable<void> {
......
import { Injectable } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { TrackingCategoryType } from '../../lib/enums/enums';
import { ITrackClickEvent } from '../../lib/interfaces/tracking/ITrackClickEvent';
import { ITrackConversionEvent } from '../../lib/interfaces/tracking/ITrackConversionEvent';
import { ITrackEvent } from '../../lib/interfaces/tracking/ITrackEvent';
import { ArsnovaClickAngulartics2Piwik } from '../../shared/tracking/ArsnovaClickAngulartics2Piwik';
interface ITrackEvent {
action: string;
category: TrackingCategoryType;
label: string;
value?: number;
customDimensions?: any;
}
export interface ITrackClickEvent {
action: string;
label: string;
value?: number;
customDimensions?: any;
}
export interface ITrackConversionEvent {
action: string;
label?: string;
}
@Injectable({
providedIn: 'root',
})
......@@ -44,7 +26,9 @@ export class TrackingService {
},
});
} catch (ex) {
console.error(ex.message);
if (!(ex instanceof ReferenceError)) {
console.error(ex.message);
}
}
}
......
......@@ -4,7 +4,7 @@ import { JwtHelperService } from '@auth0/angular-jwt';
import { ReplaySubject, Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators';
import { QuizEntity } from '../../lib/entities/QuizEntity';
import { DbState, StorageKey } from '../../lib/enums/enums';
import { DbName, DbState, StorageKey } from '../../lib/enums/enums';
import { StatusProtocol } from '../../lib/enums/Message';
import { UserRole } from '../../lib/enums/UserRole';
import { ILoginSerialized } from '../../lib/interfaces/ILoginSerialized';
......@@ -27,7 +27,7 @@ export class UserService {
this._casTicket = null;
this._staticLoginToken = null;
this._staticLoginTokenContent = null;
this._username = null;
this._username = DbName.Default;
this.deleteTokens();
} else {
this._staticLoginTokenContent = this.decodeToken();
......@@ -88,7 +88,8 @@ export class UserService {
private quizService: QuizService,
) {
this.storageService.stateNotifier.pipe(filter(type => this.username && type !== null && type !== DbState.Destroy)).subscribe((type) => {
this.storageService.stateNotifier.pipe(filter(type => this.username !== DbName.Default && type !== null && type !== DbState.Destroy))
.subscribe(() => {
if (this._staticLoginTokenContent && this._staticLoginTokenContent.privateKey) {
console.log('UserService: having static token content with private key');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment