Initial commit
This commit is contained in:
20
src/api.ts
Normal file
20
src/api.ts
Normal file
@ -0,0 +1,20 @@
|
||||
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[]>;
|
||||
}
|
Reference in New Issue
Block a user