21 lines
473 B
TypeScript
21 lines
473 B
TypeScript
|
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[]>;
|
||
|
}
|