Commit 67245b12 authored by Sébastien Chopin's avatar Sébastien Chopin

chore: Change API for hackerwebapp

parent 8f258ebb
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
modules: [ '~/modules' ], modules: [ '~/modules' ],
axios: { axios: {
baseURL: 'https://api.hnpwa.com/v0/' baseURL: 'https://api.hackerwebapp.com'
}, },
plugins: [ plugins: [
......
...@@ -69,7 +69,6 @@ export const actions = { ...@@ -69,7 +69,6 @@ export const actions = {
} }
this.feedCancelSource = CancelToken.source() this.feedCancelSource = CancelToken.source()
} }
return lazy( return lazy(
(items) => { (items) => {
const ids = items.map(item => item.id) const ids = items.map(item => item.id)
...@@ -77,7 +76,7 @@ export const actions = { ...@@ -77,7 +76,7 @@ export const actions = {
commit('SET_ITEMS', { items }) commit('SET_ITEMS', { items })
}, },
() => () =>
this.$axios.$get(`/${feed}/${page}.json`, { this.$axios.$get(`/${feed}?page=${page}`, {
cancelToken: this.feedCancelSource && this.feedCancelSource.token cancelToken: this.feedCancelSource && this.feedCancelSource.token
}), }),
(state.feeds[feed][page] || []).map(id => state.items[id]) (state.feeds[feed][page] || []).map(id => state.items[id])
...@@ -87,7 +86,7 @@ export const actions = { ...@@ -87,7 +86,7 @@ export const actions = {
FETCH_ITEM({ commit, state }, { id }) { FETCH_ITEM({ commit, state }, { id }) {
return lazy( return lazy(
item => commit('SET_ITEM', { item }), item => commit('SET_ITEM', { item }),
() => this.$axios.$get(`/item/${id}.json`), () => this.$axios.$get(`/item/${id}`),
Object.assign({ id, loading: true, comments: [] }, state.items[id]) Object.assign({ id, loading: true, comments: [] }, state.items[id])
) )
}, },
...@@ -95,7 +94,7 @@ export const actions = { ...@@ -95,7 +94,7 @@ export const actions = {
FETCH_USER({ state, commit }, { id }) { FETCH_USER({ state, commit }, { id }) {
return lazy( return lazy(
user => commit('SET_USER', { id, user }), user => commit('SET_USER', { id, user }),
() => this.$axios.$get(`/user/${id}.json`), () => this.$axios.$get(`/user/${id}`),
Object.assign({ id, loading: true }, state.users[id]) Object.assign({ id, loading: true }, state.users[id])
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment