// eslint-disable-next-line import/no-extraneous-dependencies import { createServer, Model, } from 'miragejs' import auth from './Fixtures/auth' // eslint-disable-next-line interface Props { environment: string, } export function makeServer({ environment = 'test' }: Props) { return createServer({ environment, factories: {}, fixtures: { auth, }, models: { auth: Model.extend>({}), }, routes() { this.namespace = '/api' // this.urlPrefix = Url.TokenServer // this.passthrough(); // Allow unhandled requests on the current domain to pass through this.get( '/dashboard/1.0/workplace-count-employee/:id', (schema, request) => ( schema .all('auth') .models.find( ({ structureId }) => structureId === request.params.id, )?.attrs || {} ), ) }, seeds(server) { server.loadFixtures() }, }) }