2019-01-22 20:18:44 +03:00
|
|
|
import {paginatedResponse} from '../utils';
|
|
|
|
|
|
|
|
export default function mockMembers(server) {
|
|
|
|
server.get('/members/', paginatedResponse('members'));
|
2019-02-22 14:31:45 +03:00
|
|
|
|
|
|
|
server.get('/members/:id/', function ({members}, {params}) {
|
|
|
|
let {id} = params;
|
|
|
|
let member = members.find(id);
|
|
|
|
|
|
|
|
return member || new Response(404, {}, {
|
|
|
|
errors: [{
|
2019-03-25 14:29:14 +03:00
|
|
|
type: 'NotFoundError',
|
2019-02-22 14:31:45 +03:00
|
|
|
message: 'Member not found.'
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
server.del('/members/:id/');
|
2019-01-22 20:18:44 +03:00
|
|
|
}
|