backend interactor service: implement startFetchingFollowRequest
backend interactor service: remove unused fetchFollowRequests
This commit is contained in:
parent
377b8988b6
commit
0995658757
@ -1,12 +1,7 @@
|
||||
import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service'
|
||||
|
||||
const NavPanel = {
|
||||
created () {
|
||||
if (this.currentUser && this.currentUser.locked) {
|
||||
const store = this.$store
|
||||
const credentials = store.state.users.currentUser.credentials
|
||||
|
||||
followRequestFetcher.startFetching({ store, credentials })
|
||||
this.$store.dispatch('startFetchingFollowRequest')
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -10,6 +10,10 @@ const SideDrawer = {
|
||||
}),
|
||||
created () {
|
||||
this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer)
|
||||
|
||||
if (this.currentUser && this.currentUser.locked) {
|
||||
this.$store.dispatch('startFetchingFollowRequest')
|
||||
}
|
||||
},
|
||||
components: { UserCard },
|
||||
computed: {
|
||||
|
@ -43,6 +43,13 @@ const api = {
|
||||
const fetcher = store.state.backendInteractor.startFetchingNotifications({ store })
|
||||
store.commit('addFetcher', { fetcherName: 'notifications', fetcher })
|
||||
},
|
||||
startFetchingFollowRequest (store) {
|
||||
// Don't start fetching if we already are.
|
||||
if (store.state.fetchers['followRequest']) return
|
||||
|
||||
const fetcher = store.state.backendInteractor.startFetchingFollowRequest({ store })
|
||||
store.commit('addFetcher', { fetcherName: 'followRequest', fetcher })
|
||||
},
|
||||
stopFetching (store, fetcherName) {
|
||||
const fetcher = store.state.fetchers[fetcherName]
|
||||
window.clearInterval(fetcher)
|
||||
|
@ -434,6 +434,7 @@ const users = {
|
||||
store.dispatch('stopFetching', 'friends')
|
||||
store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
|
||||
store.dispatch('stopFetching', 'notifications')
|
||||
store.dispatch('stopFetching', 'followRequest')
|
||||
store.commit('clearNotifications')
|
||||
store.commit('resetStatuses')
|
||||
})
|
||||
|
@ -1,6 +1,7 @@
|
||||
import apiService from '../api/api.service.js'
|
||||
import timelineFetcherService from '../timeline_fetcher/timeline_fetcher.service.js'
|
||||
import notificationsFetcher from '../notifications_fetcher/notifications_fetcher.service.js'
|
||||
import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service'
|
||||
|
||||
const backendInteractorService = credentials => {
|
||||
const fetchStatus = ({ id }) => {
|
||||
@ -63,6 +64,10 @@ const backendInteractorService = credentials => {
|
||||
return notificationsFetcher.startFetching({ store, credentials })
|
||||
}
|
||||
|
||||
const startFetchingFollowRequest = ({ store }) => {
|
||||
return followRequestFetcher.startFetching({ store, credentials })
|
||||
}
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
const tagUser = ({ screen_name }, tag) => {
|
||||
return apiService.tagUser({ screen_name, tag, credentials })
|
||||
@ -111,7 +116,6 @@ const backendInteractorService = credentials => {
|
||||
const subscribeUser = (id) => apiService.subscribeUser({ credentials, id })
|
||||
const unsubscribeUser = (id) => apiService.unsubscribeUser({ credentials, id })
|
||||
const fetchBlocks = () => apiService.fetchBlocks({ credentials })
|
||||
const fetchFollowRequests = () => apiService.fetchFollowRequests({ credentials })
|
||||
const fetchOAuthTokens = () => apiService.fetchOAuthTokens({ credentials })
|
||||
const revokeOAuthToken = (id) => apiService.revokeOAuthToken({ id, credentials })
|
||||
const fetchPinnedStatuses = (id) => apiService.fetchPinnedStatuses({ credentials, id })
|
||||
@ -168,6 +172,7 @@ const backendInteractorService = credentials => {
|
||||
verifyCredentials: apiService.verifyCredentials,
|
||||
startFetchingTimeline,
|
||||
startFetchingNotifications,
|
||||
startFetchingFollowRequest,
|
||||
fetchMutes,
|
||||
muteUser,
|
||||
unmuteUser,
|
||||
@ -203,7 +208,6 @@ const backendInteractorService = credentials => {
|
||||
mfaSetupOTP,
|
||||
mfaConfirmOTP,
|
||||
mfaDisableOTP,
|
||||
fetchFollowRequests,
|
||||
approveUser,
|
||||
denyUser,
|
||||
vote,
|
||||
|
Loading…
Reference in New Issue
Block a user