mardi 28 août 2018

Tasks are Deleting but the page needs to be refereshed

[Vue warn]: Property or method "id" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

This is mine Pug Code

button.btn.btn-danger.float-right#delete(v-on:click="delete_event(client_id,id)" type="button" style="margin-left:10px;")
                            i.fa.fa-trash(style="font-size:20px; color:whitesmoke;")

This is mine Vue.js Function

   delete_event:function(){

                this.loading=true;
                let url='/clients/' + this.client_id + '/events/' + this.event.id;
                this.$http.delete(url).then(res=>{
                if(res.data.errcode == 1){
                    this.$root.$refs.toastr.e(res.data.errmess,this.$t("template.Error"));
                }else{
                     this.$root.$refs.toastr.s(this.$t("client.Task_deleted"),this.$t("template.Success"));
               }      
               this.loading=false;
                },res=>{
                   this.$root.$refs.toastr.e(this.$t("template.Server_error").this.$t("template.Error"));
                   this.loading=false;
                });
           }

This is mine Controller

public function delete_event(Request $request,$client_id,$id){
        return response()->json(Event::destroy($id));
    return redirect()->back();
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NvIfq5
via IFTTT

Aucun commentaire:

Enregistrer un commentaire