Accept friend request to redirect to friends page

pull/4343/head
Kamran Ahmed 1 year ago
parent 458396f782
commit 6bc7c2f48c
  1. 11
      src/components/Befriend.tsx
  2. 1
      src/components/Toast.tsx

@ -49,6 +49,11 @@ export function Befriend() {
return; return;
} }
if (response.status === 'accepted') {
window.location.href = '/account/friends?c=fa';
return;
}
setUser(response); setUser(response);
} }
@ -78,8 +83,12 @@ export function Befriend() {
return; return;
} }
if (response.status === 'accepted') {
window.location.href = '/account/friends?c=fa';
return;
}
setUser(response); setUser(response);
toast.success(successMessage);
} }
async function deleteFriend(userId: string, successMessage: string) { async function deleteFriend(userId: string, successMessage: string) {

@ -13,6 +13,7 @@ export interface Props {}
const messageCodes: Record<string, string> = { const messageCodes: Record<string, string> = {
tl: 'Successfully left the team', tl: 'Successfully left the team',
fs: 'Friend request sent', fs: 'Friend request sent',
fa: 'Friend request accepted',
}; };
export function Toaster(props: Props) { export function Toaster(props: Props) {

Loading…
Cancel
Save