handle errors
This commit is contained in:
parent
da53e35817
commit
4b04488ce0
2 changed files with 33 additions and 14 deletions
|
|
@ -1742,6 +1742,7 @@
|
||||||
"approve_confirm_accept_button": "Approve",
|
"approve_confirm_accept_button": "Approve",
|
||||||
"approve_confirm_cancel_button": "Do not approve",
|
"approve_confirm_cancel_button": "Do not approve",
|
||||||
"approve_confirm": "Do you want to approve {user}'s follow request?",
|
"approve_confirm": "Do you want to approve {user}'s follow request?",
|
||||||
|
"approve_error": "Failure approving follow request: {error}",
|
||||||
"block": "Block",
|
"block": "Block",
|
||||||
"blocked": "Blocked!",
|
"blocked": "Blocked!",
|
||||||
"block_confirm_title": "Block confirmation",
|
"block_confirm_title": "Block confirmation",
|
||||||
|
|
@ -1754,6 +1755,7 @@
|
||||||
"deny_confirm_accept_button": "Deny",
|
"deny_confirm_accept_button": "Deny",
|
||||||
"deny_confirm_cancel_button": "Do not deny",
|
"deny_confirm_cancel_button": "Do not deny",
|
||||||
"deny_confirm": "Do you want to deny {user}'s follow request?",
|
"deny_confirm": "Do you want to deny {user}'s follow request?",
|
||||||
|
"deny_error": "Failure denying follow request: {error}",
|
||||||
"edit_profile": "Edit profile",
|
"edit_profile": "Edit profile",
|
||||||
"favorites": "Favorites",
|
"favorites": "Favorites",
|
||||||
"follow": "Follow",
|
"follow": "Follow",
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import followRequestFetcher from 'src/stores/fetchers/follow_requests.js'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useNotificationsStore } from 'src/stores/notifications.js'
|
import { useNotificationsStore } from 'src/stores/notifications.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
|
||||||
import { approveUser, denyUser } from 'src/api/user.js'
|
import { approveUser, denyUser } from 'src/api/user.js'
|
||||||
|
|
||||||
|
|
@ -79,6 +80,7 @@ export const useFollowRequestsStore = defineStore('followRequests', {
|
||||||
const id = userId ?? this.tempId
|
const id = userId ?? this.tempId
|
||||||
this.hideApproveConfirmDialog()
|
this.hideApproveConfirmDialog()
|
||||||
|
|
||||||
|
try {
|
||||||
await approveUser({
|
await approveUser({
|
||||||
id,
|
id,
|
||||||
credentials: useOAuthStore().token,
|
credentials: useOAuthStore().token,
|
||||||
|
|
@ -87,11 +89,19 @@ export const useFollowRequestsStore = defineStore('followRequests', {
|
||||||
const notifId = this.findFollowRequestNotificationId(id)
|
const notifId = this.findFollowRequestNotificationId(id)
|
||||||
notifId && useNotificationsStore().markSingleNotificationAsSeen(notifId)
|
notifId && useNotificationsStore().markSingleNotificationAsSeen(notifId)
|
||||||
this.requests.delete(id)
|
this.requests.delete(id)
|
||||||
|
} catch (error) {
|
||||||
|
useInterfaceStore().pushGlobalNotice({
|
||||||
|
messageKey: 'user_card.approve_error',
|
||||||
|
messageArgs: { error },
|
||||||
|
level: 'error',
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async doDeny(userId) {
|
async doDeny(userId) {
|
||||||
const id = userId ?? this.tempId
|
const id = userId ?? this.tempId
|
||||||
this.hideDenyConfirmDialog()
|
this.hideDenyConfirmDialog()
|
||||||
|
|
||||||
|
try {
|
||||||
await denyUser({
|
await denyUser({
|
||||||
id,
|
id,
|
||||||
credentials: useOAuthStore().token,
|
credentials: useOAuthStore().token,
|
||||||
|
|
@ -100,6 +110,13 @@ export const useFollowRequestsStore = defineStore('followRequests', {
|
||||||
const notifId = this.findFollowRequestNotificationId(id)
|
const notifId = this.findFollowRequestNotificationId(id)
|
||||||
notifId && useNotificationsStore().markSingleNotificationAsSeen(notifId)
|
notifId && useNotificationsStore().markSingleNotificationAsSeen(notifId)
|
||||||
this.requests.delete(id)
|
this.requests.delete(id)
|
||||||
|
} catch (error) {
|
||||||
|
useInterfaceStore().pushGlobalNotice({
|
||||||
|
messageKey: 'user_card.deny_error',
|
||||||
|
messageArgs: { error },
|
||||||
|
level: 'error',
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Utility
|
// Utility
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue