fix: update console deps (#9628)

# Which Problems Are Solved
Closes most of the dependabot alerts

# How the Problems Are Solved
Updating Versions as much as possible. Angular upgrade was left out on
purpose.

# Additional Changes
Some refactoring of unused code, which I stumbled upon looking at our
used deps.
This commit is contained in:
Ramon
2025-03-26 10:15:17 +01:00
committed by GitHub
parent febf410d80
commit b04babb4ef
10 changed files with 343 additions and 1121 deletions
+5 -10
View File
@@ -1,7 +1,7 @@
import { Injectable, OnDestroy } from '@angular/core';
import { DestroyRef, Injectable, OnDestroy } from '@angular/core';
import { EnvironmentService } from './environment.service';
import { Subscription } from 'rxjs';
import posthog from 'posthog-js';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Injectable({
providedIn: 'root',
@@ -9,17 +9,16 @@ import posthog from 'posthog-js';
export class PosthogService implements OnDestroy {
private posthogToken?: string;
private posthogUrl?: string;
private envSubscription: Subscription;
constructor(private envService: EnvironmentService) {
this.envSubscription = this.envService.env.subscribe((env) => {
constructor(envService: EnvironmentService, destroyRef: DestroyRef) {
envService.env.pipe(takeUntilDestroyed(destroyRef)).subscribe((env) => {
this.posthogToken = env.posthog_token;
this.posthogUrl = env.posthog_url;
this.init();
});
}
async init() {
init() {
if (this.posthogToken && this.posthogUrl) {
posthog.init(this.posthogToken, {
api_host: this.posthogUrl,
@@ -34,10 +33,6 @@ export class PosthogService implements OnDestroy {
}
ngOnDestroy() {
if (this.envSubscription) {
this.envSubscription.unsubscribe();
}
posthog.reset();
}
}