Fixes ssr

parent b92b5df8
Pipeline #18364 passed with stages
in 9 minutes and 39 seconds
......@@ -168,13 +168,32 @@ export class HomeComponent implements OnInit, OnDestroy {
}
await this.storageService.create(DB_TABLE.CONFIG, STORAGE_KEY.DEFAULT_THEME, DefaultSettings.defaultQuizSettings.theme).toPromise();
this.themesService.updateCurrentlyUsedTheme();
if (isPlatformServer(this.platformId)) {
const interval = setInterval(() => {
if (isPlatformBrowser(this.platformId)) {
clearInterval(interval);
this.themesService.updateCurrentlyUsedTheme();
}
}, 5000);
} else {
this.themesService.updateCurrentlyUsedTheme();
}
return;
}
if (isPlatformBrowser(this.platformId)) {
await this.storageService.create(DB_TABLE.CONFIG, STORAGE_KEY.DEFAULT_THEME, params.themeId).toPromise();
this.themesService.updateCurrentlyUsedTheme();
} else {
const interval = setInterval(() => {
if (isPlatformBrowser(this.platformId)) {
clearInterval(interval);
this.themesService.updateCurrentlyUsedTheme();
}
}, 5000);
}
this.i18nService.setLanguage(<LANGUAGE>params.languageId.toUpperCase());
});
}
......
import { isPlatformBrowser } from '@angular/common';
import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
import { Router } from '@angular/router';
import { IDuplicateQuiz, IMessage } from 'arsnova-click-v2-types/dist/common';
......@@ -28,7 +29,9 @@ export class FileUploadService {
private quizApiService: QuizApiService,
private storageService: StorageService,
) {
this._renameFilesQueue = new FormData();
if (isPlatformBrowser(this.platformId)) {
this._renameFilesQueue = new FormData();
}
}
public async uploadFile(formData: FormData): Promise<void> {
......
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