lundi 30 août 2021

Getting 429 (Too Many Request) in vue.js laravel

I'm using vue.js and laravel when i open edit page i get this error in my console but Update function is called on button click and bill url is also called multiple times without parameter on mounted function

app.js:1088 GET http://localhost:8000/api/userbackend/bill/undefined 404 (Not Found)

POST http://localhost:8000/api/userbackend/Update 429 (Too Many Requests)

Code Snippet:

async mounted(){
           this.roleid = this.userData.role_id;
           const header = {
                      'Authorization': 'Bearer ' + this.LoginUserData,
                };
            this.editId = this.$route.params.id;

            if(this.$route.params.id !== undefined) { 
             try{    
             
             let response = await axios.get(`/api/userbackend/bill/${this.editId}` ,{headers: header});
             this.form = response.data;
}

            saveRecord(){
                let loader = this.$loading.show();
                let formData = new FormData();
                formData.append('id', this.editId);
                ....
                
                const header = {
                        'Content-Type': 'multipart/form-data',
                        'Authorization': 'Bearer ' + this.LoginUserData,
                  };
           
          axios.post('/api/userbackend/Update', formData ,{headers: header}).then((response) =>{
                   loader.hide(); 
                    if(response.data.status == true){
                      .....
                     }   
                })
                .catch((response) => {
                    loader.hide(); 
                    this.showErrorMsg();
                 });
            },
 validateBeforeSubmit(e) {
              e.preventDefault();
                let app = this;
                this.$validator.validateAll().then((result) => {
                    if (result) {
                        app.saveRecord();
                        return;
                    }
                   this.showWarningMsg();
                });
            }

Any suggestion is highly appreciated



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire