Код не мой, человека который писал это нету. Ошибка связанная с этими частями кода такая:
Uncaught (in promise) TypeError: Cannot read property 'protocol' of null
computed: {
articlesListN() {
return this.$store.state.articlesList
}
},
mounted() {
const url = `https://#############/api/articles/scroll?cursor=cj0x&#############=8`
this.$store.dispatch('getArticlesList', url)
},
methods: {
showNext(url) {
this.$store.dispatch('getArticlesList', url)
},
showPrev(url) {
this.$store.dispatch('getArticlesList', url)
}
}
state: {
articles: [],
articlesList: { results: [] },
fullArticleList: [],
url: '',
loadArticle: false
},
getters: {
articles(state) {
return state.articles
},
articlesList(state) {
return state.articlesList
},
getFullArticle(state) {
return state.fullArticleList
},
loadArticle(state) {
return state.loadArticle
}
},
mutations: {
getArticles(state, articles) {
state.articles = articles
},
getArticlesList(state, articlesList) {
state.articlesList = articlesList
},
getFullArticle(state, article) {
state.fullArticleList.push(article.results[0])
state.url = article.previous
state.loadArticle = false
},
loadArticle(state) {
state.loadArticle = true
}
},
actions: {
async getArticles({ commit }) {
const res = await axios.get(
`https://#############/api/articles/scroll?cursor=#############=5`
)
commit('getArticles', res.data.results)
},
async getArticlesList({ commit }, url) {
const res = await axios.get(url)
commit('getArticlesList', res.data)
},
async getFullArticle({ commit }, initialId) {
commit('loadArticle')
const id = Buffer.from(`r=0&p=${initialId - 1}`).toString('base64')
const res = await axios.get(
`https://#############/api/articles/scroll?cursor=${id}&#############e=1`
)
commit('getFullArticle', res.data)
},
async addArticle({ commit, state }) {
commit('loadArticle')
const res = await axios.get(state.url)
commit('getFullArticle', res.data)
},
deleteArticles({ state }) {
state.fullArticleList = []
}
}