From d92696e2ffa65b0bfc4704e32ad622a380639f35 Mon Sep 17 00:00:00 2001 From: Simon Giesel Date: Thu, 13 Jul 2023 10:56:48 +0200 Subject: [PATCH] fix(webapp): servertime on production --- webapp/src/services/date.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/src/services/date.service.ts b/webapp/src/services/date.service.ts index ebce3da..ab3b1d2 100644 --- a/webapp/src/services/date.service.ts +++ b/webapp/src/services/date.service.ts @@ -1,6 +1,3 @@ -import { PocketbaseService } from './pocketbase.service'; - -const API = PocketbaseService.getApi(); let serverTime: Date; export class DateService { @@ -40,7 +37,10 @@ export class DateService { } public static async getServerTime(): Promise { if(!serverTime || this.isOlderThanAMinute(serverTime)) { - serverTime = new Date(await (await fetch(API.baseUrl + '/api/time')).text()); + serverTime = new Date(await (await fetch( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (import.meta as any).env.MODE === 'development' ? 'http://127.0.0.1:8090/api/time' : '/api/time', + )).text()); } return serverTime; }