const BASE_URL = "http://localhost/Kelompok06_2048";

export async function loginRequest(username, password) {
    try {
        const response = await fetch(`${BASE_URL}/Login.php`, {
            method: "POST",
            headers: {
                "Content-Type": "application/json"
            },
            body: JSON.stringify({ username, password })
        });

        return await response.json();
    } catch (err) {
        console.error("API login error:", err);
        throw err;
    }
}