50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import {Component} from '@angular/core';
|
|
import {RouterLink} from "@angular/router";
|
|
import {TextButtonComponent} from "../../../atomic/text-button/text-button.component";
|
|
import {TextLinkComponent} from "../../../atomic/text-link/text-link.component";
|
|
import {Onboarding} from "../../../model/onboarding";
|
|
|
|
@Component({
|
|
selector: 'app-notification',
|
|
imports: [
|
|
RouterLink,
|
|
TextButtonComponent,
|
|
TextLinkComponent
|
|
],
|
|
templateUrl: './notification.component.html',
|
|
styleUrl: './notification.component.css'
|
|
})
|
|
export class NotificationComponent {
|
|
enable_notifications() {
|
|
let onboarding_raw = localStorage.getItem('onboarding');
|
|
let onboarding: Onboarding;
|
|
if (!onboarding_raw) {
|
|
onboarding = {
|
|
notifications: true,
|
|
mail: '',
|
|
verified: false
|
|
};
|
|
} else {
|
|
onboarding = JSON.parse(onboarding_raw);
|
|
onboarding.notifications = true;
|
|
}
|
|
localStorage.setItem('onboarding', JSON.stringify(onboarding));
|
|
}
|
|
|
|
disable_notifications() {
|
|
let onboarding_raw = localStorage.getItem('onboarding');
|
|
let onboarding: Onboarding;
|
|
if (!onboarding_raw) {
|
|
onboarding = {
|
|
notifications: false,
|
|
mail: '',
|
|
verified: false
|
|
};
|
|
} else {
|
|
onboarding = JSON.parse(onboarding_raw);
|
|
onboarding.notifications = false;
|
|
}
|
|
localStorage.setItem('onboarding', JSON.stringify(onboarding));
|
|
}
|
|
}
|