Skip to content

Instantly share code, notes, and snippets.

@emmsdan
Last active September 15, 2020 07:54
Show Gist options
  • Save emmsdan/2cb08b615834fd328c814ae33ef15707 to your computer and use it in GitHub Desktop.
Save emmsdan/2cb08b615834fd328c814ae33ef15707 to your computer and use it in GitHub Desktop.
// <Route exact path="/staff/:staffId/:type" Component={StaffReference} />
// type == personal or work
// GET: /api/v1/get-refer/:staffId/:type
const { staffId, type } = req.params;
let findRef;
if (type === 'personal'){
findRef = await PersonalReference.findOne({ where: { staffId }});
} else if (type === 'work') {
findRef = await WorkReference.findOne({ where: { staffId }});
}
return res.json(findRef);
/*
* auto file response
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment