Skip to content

SPA video serisi için "TypeError: Cannot read property 'then' of undefined" hatası. #4

@pipks

Description

@pipks

Videoların çekildikten sonra firebase ve vuejs bileşenlerindeki güncellemelerden dolayı kodda çeşitli uyumsuzluklar ortaya çıkmış.

store.js dosyasında ki fetchMovies fonksiyonunu bitiredikten sonra sayfayı yenilediğimde consolda şöyle bir hata alıyorum.

[Vue warn]: Error in created hook: "TypeError: Cannot read property 'then' of undefined"
found in
---> <App> at src/App.vue
       <Root>
TypeError: Cannot read property 'then' of undefined
    at Store.fetchMovies (store.js?a073:17)
    at Array.wrappedActionHandler (vuex.esm.js?2f62:721)
    at Store.dispatch (vuex.esm.js?2f62:428)
    at Store.boundDispatch [as dispatch] (vuex.esm.js?2f62:322)
    at VueComponent.created (App.vue?234e:18)
    at callHook (vue.runtime.esm.js?2b0e:3038)
    at VueComponent.Vue._init (vue.runtime.esm.js?2b0e:4735)
    at new VueComponent (vue.runtime.esm.js?2b0e:4881)
    at createComponentInstanceForVnode (vue.runtime.esm.js?2b0e:4404)
    at init (vue.runtime.esm.js?2b0e:4235)

bu hataya neden olan kod blogu şöyle:

const actions = {
    fetchMovies(context) {
        return service.fetchMovies().then((snapshot) => {
          return context.commit('setMovies', snapshot.val());
        });
      }
};

bu sorunu nasıl çözebilirim acaba?

ayrıca bu ve benzeri bazı sorunları giderdikten sonra mevcut sürümlere uyumlu bir şekilde bu uygulamanın kodlarını da buraya eklememiz güzel olur bence.

Not: actions içerisinde kalan diğer fonksiyonlarda aynı hatayı aldığım için burdan ilerleme kaydedemiyorum. bu konuda yardımcı olursanız çok sevinirim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions