Skip to content

Commit

Permalink
Fix bug in publish-ci examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Ord committed May 21, 2023
1 parent c616309 commit 0444622
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion examples/publish-ci/cra4/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const handlers = [
}),

rest.get('/posts/:id', (req, res, ctx) => {
const { id } = req.params as { id: string }
const { id: idParam } = req.params as { id: string }
const id = parseInt(idParam, 10)
state = adapter.updateOne(state, {
id,
changes: { fetched_at: new Date().toUTCString() },
Expand Down
3 changes: 2 additions & 1 deletion examples/publish-ci/cra5/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const handlers = [
}),

rest.get('/posts/:id', (req, res, ctx) => {
const { id } = req.params as { id: string }
const { id: idParam } = req.params as { id: string }
const id = parseInt(idParam, 10)
state = adapter.updateOne(state, {
id,
changes: { fetched_at: new Date().toUTCString() },
Expand Down
3 changes: 2 additions & 1 deletion examples/publish-ci/next/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const handlers = [
}),

rest.get('/posts/:id', (req, res, ctx) => {
const { id } = req.params as { id: string }
const { id: idParam } = req.params as { id: string }
const id = parseInt(idParam, 10)
state = adapter.updateOne(state, {
id,
changes: { fetched_at: new Date().toUTCString() },
Expand Down
3 changes: 2 additions & 1 deletion examples/publish-ci/vite/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const handlers = [
}),

rest.get('/posts/:id', (req, res, ctx) => {
const { id } = req.params as { id: string }
const { id: idParam } = req.params as { id: string }
const id = parseInt(idParam, 10)
state = adapter.updateOne(state, {
id,
changes: { fetched_at: new Date().toUTCString() },
Expand Down
9 changes: 6 additions & 3 deletions examples/query/react/kitchen-sink/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ export const handlers = [
}),

rest.get('/posts/:id', (req, res, ctx) => {
const { id } = req.params as { id: string };
const { id: idParam } = req.params as { id: string }
const id = parseInt(idParam, 10)
state = adapter.updateOne(state, { id, changes: { fetched_at: new Date().toUTCString() } });
return res(ctx.json(state.entities[id]), ctx.delay(400));
}),

rest.put('/posts/:id', (req, res, ctx) => {
const { id } = req.params as { id: string };
const { id: idParam } = req.params as { id: string }
const id = parseInt(idParam, 10)
const changes = req.body as Partial<Post>;

state = adapter.updateOne(state, { id, changes });
Expand All @@ -84,7 +86,8 @@ export const handlers = [
}),

rest.delete('/posts/:id', (req, res, ctx) => {
const { id } = req.params as { id: string };
const { id: idParam } = req.params as { id: string }
const id = parseInt(idParam, 10)

state = adapter.removeOne(state, id);

Expand Down

0 comments on commit 0444622

Please sign in to comment.