package com.example.uitugasakhir.api

import android.content.Context
import com.android.volley.Request
import com.android.volley.toolbox.StringRequest
import com.android.volley.toolbox.Volley

object ApiDurasi {

    fun saveDurasi(
        context: Context,
        durasi: Int
    ) {

        val url =
            "http://192.168.0.105/save_duration.php"

        val request = object : StringRequest(
            Method.POST,
            url,
            {},
            {}
        ) {

            override fun getParams(): MutableMap<String, String> {

                return hashMapOf(
                    "durasi" to durasi.toString()
                )
            }
        }

        Volley.newRequestQueue(context)
            .add(request)
    }
}