duelfi_web/src/shared/data_fetcher.ts
2025-04-30 10:20:41 +00:00

16 lines
534 B
TypeScript

import { API_URL } from "@/data/shared";
export async function fetchUserById(id: string) {
const url = `${API_URL}get_user_by_id.php?id=${id}`;
const res = await fetch(url);
if (!res.ok) return null;
return await res.json();
}
export async function showNewGameNotification(username:string, game:string, wager:string){
try{
await fetch(`${API_URL}send_telegram_notification.php?username=${username}&wager=${wager}&game=${game}`)
}catch(error){
console.error("Error showing new game notification:", error);
}
}