Skip to content

Commit

Permalink
Fix eslint nested configs and eslint errors (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenf authored Sep 5, 2024
1 parent 0027b08 commit 4941138
Show file tree
Hide file tree
Showing 21 changed files with 336 additions and 500 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"editor.tabSize": 2,
"eslint.format.enable": true,
"editor.formatOnSave": true,
"eslint.codeActionsOnSave.rules": null
"eslint.codeActionsOnSave.rules": null,
"eslint.lintTask.enable": true
}
10 changes: 6 additions & 4 deletions curriculum-back/server/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ router.route('/:id/update-password')
if (newPassword.length >= 8) {
res.send(400)
}

const id = req.params.id
const user = await User.findById(id)

Expand All @@ -45,7 +45,7 @@ router.route('/:id/update-password')
await user.save()

res.send(200)
})
})

router.route('/:id')
.get(async (req, res) => {
Expand All @@ -67,11 +67,13 @@ router.route('/:id')
res.send(201)
})
.delete(async (req, res) => {

const userId = req.params.id
await User.findByIdAndDelete(userId)
res.send(200)
})

router.route('/')
.get(async (req, res) => {
.get(async (_, res) => {
const users = await User.find()
res.send(users)
})
Expand Down
1 change: 1 addition & 0 deletions curriculum-back/server/middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function authMiddleware(req, res, next) {
}
res.status(401).send('Not Authorized')
} catch(err) {
console.error(err)
res.status(401).send('Invalid Token')
}
}
Expand Down
10 changes: 6 additions & 4 deletions curriculum-back/server/utils/jwt.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import jwt from 'jsonwebtoken'

const secret = 'gwenstacy'
const header = {
typ: 'JWT',
alg: 'HS512'
}
// TODO: What should I do with this?
// const header = {
// typ: 'JWT',
// alg: 'HS512'
// }

export function generateToken(userId) {
const data = {
Expand All @@ -23,6 +24,7 @@ export function checkToken(token) {
jwt.verify(token, secret)
return true
} catch (err) {
console.error(err)
return false
}
}
Expand Down
4 changes: 2 additions & 2 deletions curriculum-back/server/utils/mailgun.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if (process.env.NODE_ENV !== 'local') {
var api_key = process.env.MAILGUN_KEY
var domain = 'mg.studytracker.tech'
// var api_key = process.env.MAILGUN_KEY
// var domain = 'mg.studytracker.tech'
// var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain})
var mailgun = { messages: () => ({ send: () => {} }) }
}
Expand Down
25 changes: 0 additions & 25 deletions curriculum-front/.eslintrc.cjs

This file was deleted.

Loading

0 comments on commit 4941138

Please sign in to comment.