mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-27 09:23:03 +03:00
29 lines
679 B
TypeScript
29 lines
679 B
TypeScript
export interface AimeServerInfo {
|
|
name: string;
|
|
}
|
|
|
|
export interface AimeCardinRequest {
|
|
id: string;
|
|
}
|
|
|
|
export async function getServerInfo(address: string) {
|
|
const response = await fetch(address, {
|
|
signal: AbortSignal.timeout(10000)
|
|
});
|
|
|
|
const json: AimeServerInfo = await response.json();
|
|
return json;
|
|
}
|
|
|
|
export function serverCardIn(address: string, id: string) {
|
|
return fetch(`${address}/card`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
id: id
|
|
} satisfies AimeCardinRequest),
|
|
signal: AbortSignal.timeout(5000)
|
|
});
|
|
} |