2020-01-18 00:32:40 +00:00
|
|
|
const userQueries = require('../../data/queries/user');
|
|
|
|
const verifyToken = require('../../services/verifyToken');
|
|
|
|
|
|
|
|
const apiIndex = async (req, res, next) => {
|
|
|
|
try {
|
|
|
|
if (req.cookies && req.cookies.token) {
|
|
|
|
const token = req.cookies.token;
|
2020-01-18 05:18:50 +00:00
|
|
|
const verifiedToken = await verifyToken(token);
|
|
|
|
res.status(200).send(verifiedToken.user)
|
2020-01-18 00:32:40 +00:00
|
|
|
}
|
|
|
|
res.status(200).json()
|
|
|
|
}
|
|
|
|
|
2020-01-18 05:18:50 +00:00
|
|
|
catch (err) {
|
2020-01-18 00:32:40 +00:00
|
|
|
res.status(500).json(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
apiIndex
|
|
|
|
}
|