You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
/**
|
|
* Generated by orval v6.31.0 🍺
|
|
* Do not edit manually.
|
|
* pkh-api
|
|
* pkh api
|
|
* OpenAPI spec version: 0.0.1
|
|
*/
|
|
import { faker } from '@faker-js/faker';
|
|
import { HttpResponse, delay, http } from 'msw';
|
|
import type { AuthenticationControllerLogin200 } from '../../models';
|
|
|
|
export const getAuthenticationControllerLoginResponseMock = (
|
|
overrideResponse: Partial<AuthenticationControllerLogin200> = {},
|
|
): AuthenticationControllerLogin200 => ({
|
|
token: faker.helpers.arrayElement([faker.word.sample(), undefined]),
|
|
...overrideResponse,
|
|
});
|
|
|
|
export const getAuthenticationControllerLoginMockHandler = (
|
|
overrideResponse?:
|
|
| AuthenticationControllerLogin200
|
|
| ((
|
|
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
) => Promise<AuthenticationControllerLogin200> | AuthenticationControllerLogin200),
|
|
) => {
|
|
return http.post('*/users/login', async (info) => {
|
|
await delay(1000);
|
|
return new HttpResponse(
|
|
JSON.stringify(
|
|
overrideResponse !== undefined
|
|
? typeof overrideResponse === 'function'
|
|
? await overrideResponse(info)
|
|
: overrideResponse
|
|
: getAuthenticationControllerLoginResponseMock(),
|
|
),
|
|
{
|
|
status: 200,
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
},
|
|
);
|
|
});
|
|
};
|
|
export const getAuthenticationControllerMock = () => [getAuthenticationControllerLoginMockHandler()];
|