generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Progress Fetching Logic to Include
dev
Query Parameter (#1308)
* added dev query in getProgressApi hook * fix test naming * add dev=flase test * improve the progresses test
- Loading branch information
1 parent
00519da
commit 3f71ebb
Showing
4 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import { rest } from 'msw'; | ||
import { mockGetTaskProgress } from '../db/progresses'; | ||
|
||
const URL = process.env.NEXT_PUBLIC_BASE_URL; | ||
|
||
export const progressHandler = [ | ||
rest.get(`${URL}/progresses?taskId=OxYqJgf6Tyl90uci1mzs`, (_, res, ctx) => { | ||
return res(ctx.status(200), ctx.json(mockGetTaskProgress)); | ||
}), | ||
rest.get( | ||
`${URL}/progresses?taskId=OxYqJgf6Tyl90uci1mzs`, | ||
(req, res, ctx) => { | ||
const devFlag = req.url.searchParams.get('dev'); | ||
|
||
const progressData = { | ||
...mockGetTaskProgress, | ||
data: mockGetTaskProgress.data.map((progress) => | ||
devFlag === 'true' | ||
? { ...progress } | ||
: { ...progress, userData: undefined } | ||
), | ||
}; | ||
|
||
return res(ctx.status(200), ctx.json(progressData)); | ||
} | ||
), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters