forked from Kispi/Core
fix(webapp): servertime on production
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c98b51c22a
commit
d92696e2ff
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,3 @@
|
||||||
import { PocketbaseService } from './pocketbase.service';
|
|
||||||
|
|
||||||
const API = PocketbaseService.getApi();
|
|
||||||
let serverTime: Date;
|
let serverTime: Date;
|
||||||
|
|
||||||
export class DateService {
|
export class DateService {
|
||||||
|
@ -40,7 +37,10 @@ export class DateService {
|
||||||
}
|
}
|
||||||
public static async getServerTime(): Promise<Date> {
|
public static async getServerTime(): Promise<Date> {
|
||||||
if(!serverTime || this.isOlderThanAMinute(serverTime)) {
|
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;
|
return serverTime;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue