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