reminder-dashboard/src/api.ts

21 lines
473 B
TypeScript
Raw Normal View History

2023-10-28 13:50:37 +00:00
import axios from "axios";
type UserInfo = {
name: string;
patreon: boolean;
timezone: string | null;
};
export type GuildInfo = {
id: string;
name: string;
};
export function fetchUserInfo(): Promise<UserInfo> {
return axios.get("/api/user").then((resp) => resp.data) as Promise<UserInfo>;
}
export function fetchUserGuilds(): Promise<GuildInfo[]> {
return axios.get("/api/user/guilds").then((resp) => resp.data) as Promise<GuildInfo[]>;
}