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

export async function registerRequest(username, password) {
    if (!username || !password) {
        return { status: "error", message: "Username dan password wajib diisi" };
    }

    const formData = new FormData();
    formData.append("username", username);
    formData.append("password", password);

    try {
        const response = await fetch(`${BASE_URL}/Register.php`, {
            method: "POST",
            headers: {
                "Accept": "application/json"
            },
            body: formData
        });
        return await response.json();
    } catch (err) {
        return { status: "error", message: err.message };
    }
}