Skip to content

Commit

Permalink
Some refactored for set error in backend (#253)
Browse files Browse the repository at this point in the history
* Refactored styles for global version and fixed bug with pagination

* Added backend for tournament history

* Added toggle add tournament to history in front

* Styled like tournament button

* Added slice and thunks for tournament history

* Feature with tournament history done

* Some refactored for set error in backend
  • Loading branch information
AlikhanKubatbekov authored Jan 27, 2025
1 parent 1ee137c commit d8e132b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/src/controllers/rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export const getRewards = async (req: Request, res: Response, next: NextFunction
.limit(limit)
.lean();

if (rewards.length === 0) {
return res.status(404).send({ error: 'На данный момент у вас нету наград!' });
}

if (rewards.length === 0 && page > 1) {
page = 1;
startIndex = 0;
Expand Down
4 changes: 4 additions & 0 deletions backend/src/controllers/tournamentHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export const getTournamentHistory = async (req: Request, res: Response, next: Ne
})
.lean();

if (tournamentHistory.length === 0) {
return res.status(404).send({ error: 'На данный момент у вас нету избранных турниров!' });
}

if (tournamentHistory.length === 0 && page > 1) {
page = 1;
startIndex = 0;
Expand Down

0 comments on commit d8e132b

Please sign in to comment.