Tasks are Deleted but the page needs to be refreshed

Posted 11 months ago by asad98iftikhar

This is mine Vue.js Code

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.$emit('delete');
           }      
           this.loading=false;
            },res=>{
               this.$root.$refs.toastr.e(this.$t("template.Server_error").this.$t("template.Error"));
               this.loading=false;
            });
       }

This is mine Vue.js Button for Delete 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 Controller

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

Please sign in or create an account to participate in this conversation.