diff --git a/models/TrackData.js b/models/TrackData.js index f084287..abaf817 100644 --- a/models/TrackData.js +++ b/models/TrackData.js @@ -1,6 +1,5 @@ const mongoose = require('mongoose'); const uniqueValidator = require('mongoose-unique-validator'); -const slug = require('slug'); const schema = new mongoose.Schema( { diff --git a/routes/api/profiles.js b/routes/api/profiles.js index c4ed5ea..7d435ee 100644 --- a/routes/api/profiles.js +++ b/routes/api/profiles.js @@ -33,7 +33,7 @@ router.post( auth.required, wrapRoute(async (req, res) => { await req.user.follow(req.profile._id); - return res.json({ profile: req.profile.toProfileJSONFor(user) }); + return res.json({ profile: req.profile.toProfileJSONFor(req.user) }); }), ); @@ -42,7 +42,7 @@ router.delete( auth.required, wrapRoute(async (req, res) => { await req.user.unfollow(req.profile._id); - return res.json({ profile: req.profile.toProfileJSONFor(user) }); + return res.json({ profile: req.profile.toProfileJSONFor(req.user) }); }), ); diff --git a/routes/api/users.js b/routes/api/users.js index fd183b6..07a19f3 100644 --- a/routes/api/users.js +++ b/routes/api/users.js @@ -1,7 +1,5 @@ -const mongoose = require('mongoose'); const router = require('express').Router(); const passport = require('passport'); -const User = mongoose.model('User'); const wrapRoute = require('../../_helpers/wrapRoute'); const auth = require('../auth');