generated from nhcarrigan/template
41 lines
996 B
TypeScript
41 lines
996 B
TypeScript
/**
|
|
* @copyright nhcarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
import { CommonModule, DatePipe } from "@angular/common";
|
|
import { Component } from "@angular/core";
|
|
import { SanctionsService } from "../sanctions.js";
|
|
|
|
@Component({
|
|
imports: [ CommonModule, DatePipe ],
|
|
selector: "app-sanctions",
|
|
styleUrl: "./sanctions.css",
|
|
templateUrl: "./sanctions.html",
|
|
})
|
|
export class Sanctions {
|
|
public sanctions: Array<{
|
|
number: number;
|
|
uuid: string;
|
|
type: string;
|
|
platform: string;
|
|
reason: string;
|
|
username: string;
|
|
createdAt: string;
|
|
}> = [];
|
|
public constructor(
|
|
private readonly sanctionsService: SanctionsService,
|
|
) {
|
|
void this.loadSanctions();
|
|
}
|
|
|
|
private async loadSanctions(): Promise<void> {
|
|
const sanctions = await this.sanctionsService.getSanctions();
|
|
this.sanctions = sanctions.sort((a, b) => {
|
|
return b.createdAt > a.createdAt
|
|
? 1
|
|
: -1;
|
|
});
|
|
}
|
|
}
|