Ghost/ghost/admin/mirage/config/members.js
2019-02-22 18:32:09 +07:00

20 lines
515 B
JavaScript

import {paginatedResponse} from '../utils';
export default function mockMembers(server) {
server.get('/members/', paginatedResponse('members'));
server.get('/members/:id/', function ({members}, {params}) {
let {id} = params;
let member = members.find(id);
return member || new Response(404, {}, {
errors: [{
errorType: 'NotFoundError',
message: 'Member not found.'
}]
});
});
server.del('/members/:id/');
}