K
K
Konstantin Malyarov2018-11-20 15:55:30
Vue.js
Konstantin Malyarov, 2018-11-20 15:55:30

How to use vue-resource in filters?

getPatientInDateTime: function (user, datetime) {
            this.$http.get('http://' + window.location.hostname + '/api/day-plans/?user=' + user.id + '&start=' + datetime
            ).then(response => {
                console.log(response.body)
            }, response => {
                console.log("Ошибка получения профиля пациента")
            })
        }

Returns an error:
vue.js:597 [Vue warn]: Error in render: "TypeError: Cannot read property 'get' of undefined"

(found in <Root>)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2018-11-20
@Konstantin18ko

You can write Vue.http instead of this.$http

getPatientInDateTime: function (user, datetime) {
            Vue.http.get('http://' + window.location.hostname + '/api/day-plans/?user=' + user.id + '&start=' + datetime
            ).then(response => {
                console.log(response.body)
            }, response => {
                console.log("Ошибка получения профиля пациента")
            })
        }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question