This repository has been archived on 2024-11-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mastodon-apps/projects/mastolists/src/app/app.component.ts

39 lines
1.3 KiB
TypeScript

import {Component, isDevMode} from '@angular/core';
import {select, Store} from "@ngrx/store";
import {fromApplication, fromAuthorize, selectIsLoggedIn} from "./shared/state/store";
import {environment} from "../environments/environment";
// @ts-ignore
import packageJson from '../../../../package.json';
import {tap} from "rxjs";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
appName = environment.appName;
version = packageJson.version;
navigationItems = [
{title: 'Authorize', link: '/authorize'},
{title: 'Stats', link: '/sync'},
{title: 'Edit Lists', link: '/lists'},
{title: 'List view', link: '/followings/list'},
{title: 'Matrix View', link: '/followings/matrix'},
{title: 'Table View', link: '/followings/table'},
];
constructor(private store: Store) {
this.store.dispatch(fromAuthorize.loadLocalStorage());
this.store.pipe(
select(selectIsLoggedIn),
).subscribe((loggedIn) => {
if (loggedIn && !isDevMode()) {
this.store.dispatch(fromApplication.loadLists());
this.store.dispatch(fromApplication.loadFollowings());
}
});
}
}