chore: cleanup

This commit is contained in:
2023-11-01 00:40:12 +09:00
parent 8f90daa840
commit c65bb7a992
56 changed files with 344 additions and 221 deletions

View File

@ -1,3 +1,4 @@
import { throwIfOffline } from "@snort/shared";
import { NostrEvent } from "@snort/system";
export interface TrendingUser {
@ -52,6 +53,7 @@ export default class NostrBandApi {
}
async #json<T>(method: string, path: string) {
throwIfOffline();
const res = await fetch(`${this.#url}${path}`, {
method: method ?? "GET",
});

View File

@ -1,3 +1,5 @@
import { throwIfOffline } from "@snort/shared";
export interface RecommendedProfilesResponse {
quality: number;
recommendations: Array<[pubkey: string, score: number]>;
@ -26,6 +28,7 @@ export default class SemisolDevApi {
}
async #json<T>(method: string, path: string, body?: unknown) {
throwIfOffline();
const url = `${this.#url}${path}`;
const res = await fetch(url, {
method: method ?? "GET",

View File

@ -1,3 +1,4 @@
import { throwIfOffline } from "@snort/shared";
import { EventKind, EventPublisher } from "@snort/system";
import { ApiHost } from "Const";
import { SubscriptionType } from "Subscription";
@ -131,6 +132,7 @@ export default class SnortApi {
body?: object,
headers?: { [key: string]: string },
): Promise<T> {
throwIfOffline();
const rsp = await fetch(`${this.#url}${path}`, {
method: method,
body: body ? JSON.stringify(body) : undefined,