Skip to content

Commit d7d2cb9

Browse files
fix: catch 409 error when trying to create two match requests on the same day
1 parent c9a7c8a commit d7d2cb9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

client/src/components/MatchRequests.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ const MatchRequests = () => {
8383
await submitMatchRequest(matchRequestData);
8484
setIsCreateDialogOpen(false);
8585
await fetchMatchRequests();
86-
} catch (err) {
87-
setError('Failed to create match request. Please try again later.');
86+
} catch (err: any) {
87+
if (err?.response?.status === 409) {
88+
setError('You can only create one match request per day.');
89+
} else {
90+
setError('Failed to create match request. Please try again later.');
91+
}
8892
console.error('Error creating match request:', err);
8993
}
9094
};

0 commit comments

Comments
 (0)