Files
hikari/client/src/app/sanctions.ts
T
naomi bc2368866e
Node.js CI / Lint and Test (push) Successful in 1m36s
chore: use live sanction api url
2025-08-25 16:30:32 -07:00

45 lines
994 B
TypeScript

/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Injectable } from "@angular/core";
@Injectable({
providedIn: "root",
})
export class SanctionsService {
public constructor() {}
// eslint-disable-next-line @typescript-eslint/class-methods-use-this -- Getter for static URL.
private get url(): string {
return "https://hikari.nhcarrigan.com/api/sanctions";
}
public async getSanctions(): Promise<
Array<{
number: number;
uuid: string;
type: string;
platform: string;
reason: string;
username: string;
createdAt: string;
}>
> {
const response = await fetch(this.url);
if (!response.ok) {
return [];
}
return (await response.json()) as Array<{
number: number;
uuid: string;
type: string;
platform: string;
reason: string;
username: string;
createdAt: string;
}>;
}
}