feat: apply for leader

This commit is contained in:
2023-12-18 16:58:30 +00:00
parent a937c75c64
commit 7040253f32
6 changed files with 125 additions and 27 deletions

View File

@ -81,6 +81,8 @@ export interface RelayDistance {
export interface RefCodeResponse {
code: string;
pubkey: string;
revShare?: number;
leaderState?: "pending" | "approved";
}
export default class SnortApi {
@ -148,6 +150,10 @@ export default class SnortApi {
return this.#getJson<RefCodeResponse>(`api/v1/referral/${code}`, "GET");
}
applyForLeader() {
return this.#getJsonAuthd<RefCodeResponse>("api/v1/referral/leader-apply", "POST");
}
async #getJsonAuthd<T>(
path: string,
method?: "GET" | string,