<?php
session_start();
$api_name = $_POST['api_name'];
$api_url = $_POST['api_url'];
$api_key = $_POST['api_key'];
$country_code = $_POST['country_code'];
include("../auth.php");


if($api_name !="" && $api_url !="" &&  $api_key !="" && $country_code !=""){
 if(!add_api($pdo,$api_name,$api_key,$api_url,$country_code)){
     echo'<script>
    $(document).ready(function() {
        Swal.fire({
            title: "Warning!",
            text: "Something Error while Adding APi",
            icon: "warning",
            button: "Ok",
            
        });
    });
</script>'; 
 }else{
     echo'<script>
    $(document).ready(function() {
        Swal.fire({
            title: "Success",
            text: "Details Added Successful",
            icon: "success",
            button: "Ok",
            
        });
    });
</script>'; 
 }
}else{
echo'<script>
    $(document).ready(function() {
        Swal.fire({
            title: "Warning!",
            text: "Please fill all the fields first",
            icon: "warning",
            button: "Ok",
            
        });
    });
</script>';   
}

?>