diff options
| author | Wyatt Benno <wyattbenno@gmail.com> | 2019-12-09 09:02:34 +0900 |
|---|---|---|
| committer | Wyatt Benno <wyattbenno@gmail.com> | 2019-12-09 09:02:34 +0900 |
| commit | e86af0c965d459d016d638c0822bc9af6a6c0ee1 (patch) | |
| tree | 6a1f446d7bf2305bf4b3837041f6f4254fcc1910 /src | |
| parent | 01855f315c7db813d7bbf2f3683017819d2fb70c (diff) | |
Change naming, make more general
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/timeline/timeline.js | 4 | ||||
| -rw-r--r-- | src/components/timeline/timeline.vue | 12 | ||||
| -rw-r--r-- | src/modules/statuses.js | 10 | ||||
| -rw-r--r-- | src/services/api/api.service.js | 5 | ||||
| -rw-r--r-- | src/services/timeline_fetcher/timeline_fetcher.service.js | 6 |
5 files changed, 17 insertions, 20 deletions
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 6086336c..9a53acd6 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -39,8 +39,8 @@ const Timeline = { timelineError () { return this.$store.state.statuses.error }, - error403 () { - return this.$store.state.statuses.error403 + errorData () { + return this.$store.state.statuses.errorData }, newStatusCount () { return this.timeline.newStatusCount diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index e4d453b8..d9f4025d 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -12,21 +12,21 @@ {{ $t('timeline.error_fetching') }} </div> <div - v-else-if="error403" + v-else-if="errorData" class="loadmore-error alert error" @click.prevent > {{ $t('timeline.error_403') }} </div> <button - v-if="timeline.newStatusCount > 0 && !timelineError && !error403" + v-if="timeline.newStatusCount > 0 && !timelineError && !errorData" class="loadmore-button" @click.prevent="showNewStatuses" > {{ $t('timeline.show_new') }}{{ newStatusCountStr }} </button> <div - v-if="!timeline.newStatusCount > 0 && !timelineError && !error403" + v-if="!timeline.newStatusCount > 0 && !timelineError && !errorData" class="loadmore-text faint" @click.prevent > @@ -74,17 +74,17 @@ {{ $t('timeline.no_more_statuses') }} </div> <a - v-else-if="!timeline.loading && !error403" + v-else-if="!timeline.loading && !errorData" href="#" @click.prevent="fetchOlderStatuses()" > <div class="new-status-notification text-center panel-footer">{{ $t('timeline.load_older') }}</div> </a> <a - v-else-if="error403" + v-else-if="errorData" href="#" > - <div class="new-status-notification text-center panel-footer">{{ error403 }}</div> + <div class="new-status-notification text-center panel-footer">{{ errorData }}</div> </a> <div v-else diff --git a/src/modules/statuses.js b/src/modules/statuses.js index d0e871c8..4068aa02 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -38,7 +38,7 @@ export const defaultState = () => ({ notifications: emptyNotifications(), favorites: new Set(), error: false, - error403: false, + errorData: '', timelines: { mentions: emptyTl(), public: emptyTl(), @@ -480,8 +480,8 @@ export const mutations = { setError (state, { value }) { state.error = value }, - set403Error (state, { value }) { - state.error403 = value + setErrorData (state, { value }) { + state.errorData = value }, setNotificationsLoading (state, { value }) { state.notifications.loading = value @@ -532,8 +532,8 @@ const statuses = { setError ({ rootState, commit }, { value }) { commit('setError', { value }) }, - set403Error ({ rootState, commit }, { value }) { - commit('set403Error', { value }) + setErrorData ({ rootState, commit }, { value }) { + commit('setErrorData', { value }) }, setNotificationsLoading ({ rootState, commit }, { value }) { commit('setNotificationsLoading', { value }) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index a2aa802f..45b63caf 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -532,10 +532,7 @@ const fetchTimeline = ({ return fetch(url, { headers: authHeaders(credentials) }) .then((data) => { - if (data.ok || data.status === 403) { - return data - } - throw new Error('Error fetching timeline', data) + return data }) .then((data) => data.json()) .then((data) => { diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index b7952050..1aaae563 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -6,7 +6,7 @@ const update = ({ store, statuses, timeline, showImmediately, userId }) => { const ccTimeline = camelCase(timeline) store.dispatch('setError', { value: false }) - store.dispatch('set403Error', { value: false }) + store.dispatch('setErrorData', { value: false }) store.dispatch('addNewStatuses', { timeline: ccTimeline, @@ -46,9 +46,9 @@ const fetchAndUpdate = ({ return apiService.fetchTimeline(args) .then((statuses) => { - // Change messaging if not public if (statuses.error) { - store.dispatch('set403Error', { value: statuses.error }) + console.log(statuses) + store.dispatch('setErrorData', { value: statuses.error }) return } if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) { |
