vue 发送ajax请求之 邮箱

                let url = '/emails/';
                axios.put(url, {
                    email: this.email
                }, {
                    headers: {
                        'X-CSRFToken':getCookie('csrftoken')
                    },
                    responseType: 'json'
                })
                    .then(response => {
                        if (response.data.code == '0') {
                            this.set_email = false;
                            this.send_email_btn_disabled = true;
                            this.send_email_tip = '已发送验证邮件';
                        } else if (response.data.code == '4101') {
                            location.href = '/login/?next=/info/';
                        } else {
                            alert(response.data.errmsg);
                        }
                    })
                    .catch(error => {
                        console.log(error.response);
                    });

 

posted @ 2020-10-06 00:02  酸辣土豆皮  阅读(299)  评论(0编辑  收藏  举报