21 lines
531 B
TypeScript
21 lines
531 B
TypeScript
import { axios } from "@/api/index";
|
|
|
|
const EDITIONS_ENDPOINT = "/editions";
|
|
const REGISTER_ENDPOINT = "/register";
|
|
|
|
export async function editions() {
|
|
const response = await axios.get(EDITIONS_ENDPOINT);
|
|
|
|
return response.data;
|
|
}
|
|
|
|
export async function join(key: string): Promise<boolean> {
|
|
try {
|
|
await axios.post(REGISTER_ENDPOINT, JSON.stringify(key), { headers: { "Content-Type": "application/json" } });
|
|
return true;
|
|
} catch (error) {
|
|
console.error(error);
|
|
return false;
|
|
}
|
|
}
|