Questions tagged [miragejs]
50 questions
0
votes
4 answers
MirageJs does not throw status 400
I am new to react and I'm working on react fetch using useEffect.
Im using miragejs to mimic an api server. I am testing the sad path and have made the miragejs API to return a 400 status code.
im using miragejs to mimic an api server.
here is the…

manjosh
- 438
- 6
- 28
0
votes
0 answers
MirageJS GraphQL resolver returning empty list despite being called
I'm using Mirage.js to mock my GraphQL API, but I'm encountering an issue with my resolver. Although I can see that the resolver is being called (console.log statements are executed), the response I receive always has an empty list (list: null). I…

Tomer
- 17,787
- 15
- 78
- 137
0
votes
0 answers
can we use websocket with miragejs in vuejs3 app?
I have to use websocket with mocking library miragejs for vuejs3 app.
I have created websocket server and connection but didnot understand how to use miragejs server along with websocket server
0
votes
0 answers
Creating new data with mirage js
so I'm quite new to MirageJS and I'm having trouble with its 'create' function. Here's my code for creating new data.
const _create = _this => {
_this.post('/section/create', async (schema, request) => {
return schema.links.create("UI",{
…

julcodecode
- 83
- 6
0
votes
0 answers
Unable to mock API request using miragejs in ReactNative Typescript because window is not defined
I am building a mobile application using ReactNative. My app is interacting with an API. I am trying to mock the API requests using Mirage JS when I am building the app locally following this link,…

Wai Yan Hein
- 13,651
- 35
- 180
- 372
0
votes
1 answer
Is there a type for Mirage.js's schema when working with Typescript
Am using mirage.js to mock an API that's not complete using typescript in strict mode. I am having trouble with the schema type in the routes() method.
It works, I just want to avoid the warning that comes with using any as the type.
A simple…

jogarcia
- 2,327
- 2
- 19
- 34
0
votes
1 answer
React: Uncaught TypeError: Cannot destructure property 'id' of '_ref' as it is undefined
Been trying to figure this out for a couple hours now but I'm stumped. According to the console, when I make a patch request, the request goes through and actually updates the information, but my map function is breaking after that and it renders a…

Casey MacLeod
- 31
- 1
- 6
0
votes
2 answers
Mirage JS json data is console logging but not rendering on the page in React
I am working on a coding assessment and running into a problem when it comes to rendering dummy data from Mirage JS on my page. When I console log the data I'm looking for it shows up fine in the console but I can't figure out why it's not rendering…

Casey MacLeod
- 31
- 1
- 6
0
votes
1 answer
React native with Axios - post method with body returns timeout
I am attempting to create a miragejs server with a post request but am receiving a timeout every time I make a call. Strangely get/delete endpoints return fine but post/put endpoints hang indefinitely resulting in jest timeout error:
Timeout - Async…

Dzone64
- 98
- 7
0
votes
1 answer
Serialize MirageJS response to fit EF Core API type List<>
I am trying to mock my EF Core API using Mirage but cannot figure out how to serialize my output. The front end is expecting something like:
[{id:1, name:"name1", weight: 150}, {id:2, name:"name2", weight: 140}]
but Mirage is returning something…

nolanxiii
- 41
- 4
0
votes
1 answer
TypeScript, Vue, and MirageJS: Problems with TS compile errors
The problem: I am required to use Vue and MirageJS in a TypeScript web app, and in that web app, I get TS compile errors.
The code:
import { Server, Model } from 'miragejs'
export function makeServer({ environment = "development" } = {}) {
let…

MadBanana
- 35
- 1
- 6
0
votes
1 answer
How to call mirage server before application starts in StencilJS
I am working on a StencilJS project where I have to use MirageJS to make fake API data.
How to call server before StencilJS application loads.
In react we can call makeServer() in the index.ts file, but in the stencil, we don't have such a file.
How…

MogerCS
- 342
- 1
- 5
- 16
0
votes
1 answer
How to redirect MirajeJS to a real request if there is no such route in mocks?
With the help of mirajeJS, we can simulate routes, but is it possible, if such a route is not simulated in mirajeJS, to redirect it and use a real server using axios?
import {Server} from "miragejs";
new Server({
routes() {
this.namespace =…

Ksenia
- 950
- 6
- 24
0
votes
1 answer
miragejs '[WDS] Disconnected!' instantly
If I createServer with miragejs, WDS (Webpack Dev Server) get disconnected.
if I disable mirages mock server, WDS works I expected.
Here is full call stack of [WDS] Disconnected!
src/index.tsx
import { mockServer } from './server';
if…

ibocon
- 1,352
- 3
- 17
- 40
0
votes
1 answer
how the data is destructured in this example?
im making a project diary App by follwing an article. it uses redux toolkit and miraj as a fake server.
it has a component named Editor
const Editor: FC = () => {
const { currentlyEditing: entry, canEdit, activeDiaryId } = useSelector(
…

Mahmood Ahmed Khan
- 235
- 3
- 9