<template>
    <section>
        <h2 class="text-center g-py-20 g-mb-30">Tambah Warehouse Stock</h2>
        <div class="container-fluid">
            <div class="row">
                <div class="col-12 col-md-12 col-lg-12 g-mb-20">
                    <div class="border box-shadow g-pa-20">
                        <form action="" v-on:submit.prevent="submitForm">
                            <div class="form-group g-mb-15">
                                <label for="nama">Nama</label>
                                <input type="text" class="form-control" id="nama" placeholder="Nama Kategori Aset" v-model="form.nama">
                            </div>
                            <button id="submit" type="submit" class="btn btn-orange d-block text-center g-mt-40">Tambah Kategori Aset</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
</template>

<style scoped>
a {
    color: #ff6d00;
}
</style>

<script>
import axios from 'axios'

export default {
    name: 'PostFormAxios',
    data(){
        return{
            form: {
                nama: ''
            }
        }
    },
    methods:{
        submitForm(){
            axios.post('https://werp-api.pt-gti.co.id/kategoriaset', this.form)
                .then((res) => {
                    //Perform Success Action
                    location.href = "/kategoriaset"
                })
                .catch((error) => {
                    // error.response.status Check status code
                    console.log(error.response)
                }).finally(() => {
                    //Perform action in always
                });
        }
    }
}
</script>