UNPKG

game-library-sdk-mgs

Version:

SDK to integrate games with the game library platform.

27 lines (23 loc) 748 B
// game.js const launchGame = async (gameId) => { const token = localStorage.getItem("token"); if (!token) { alert("❌ لم يتم تسجيل الدخول!"); return; } const response = await fetch("http://localhost:3000/api/launch", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${token}`, }, body: JSON.stringify({ game_id: gameId }), }); const data = await response.json(); if (data.success) { alert("✅ تم تشغيل اللعبة بنجاح!"); } else { alert("❌ فشل التشغيل: " + data.error); } }; module.exports = { launchGame };