From 6bc7c2f48c466a391da3810d40828fb565b4d68a Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 15 Aug 2023 00:18:49 +0100 Subject: [PATCH] Accept friend request to redirect to friends page --- src/components/Befriend.tsx | 11 ++++++++++- src/components/Toast.tsx | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/Befriend.tsx b/src/components/Befriend.tsx index b972471d9..f963b881c 100644 --- a/src/components/Befriend.tsx +++ b/src/components/Befriend.tsx @@ -49,6 +49,11 @@ export function Befriend() { return; } + if (response.status === 'accepted') { + window.location.href = '/account/friends?c=fa'; + return; + } + setUser(response); } @@ -78,8 +83,12 @@ export function Befriend() { return; } + if (response.status === 'accepted') { + window.location.href = '/account/friends?c=fa'; + return; + } + setUser(response); - toast.success(successMessage); } async function deleteFriend(userId: string, successMessage: string) { diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx index 383c184da..ceca924a5 100644 --- a/src/components/Toast.tsx +++ b/src/components/Toast.tsx @@ -13,6 +13,7 @@ export interface Props {} const messageCodes: Record = { tl: 'Successfully left the team', fs: 'Friend request sent', + fa: 'Friend request accepted', }; export function Toaster(props: Props) {