Fix jwt-token
This commit is contained in:
@@ -32,7 +32,7 @@ const updateDeviceSchema = Joi.object({
|
||||
});
|
||||
|
||||
// GET /api/devices - Get all devices
|
||||
router.get('/', async (req, res) => {
|
||||
router.get('/', authenticateToken, async (req, res) => {
|
||||
try {
|
||||
const {
|
||||
include_stats = false,
|
||||
@@ -122,7 +122,7 @@ router.get('/', async (req, res) => {
|
||||
});
|
||||
|
||||
// GET /api/devices/map - Get devices with location data for map display
|
||||
router.get('/map', async (req, res) => {
|
||||
router.get('/map', authenticateToken, async (req, res) => {
|
||||
try {
|
||||
const devices = await Device.findAll({
|
||||
where: {
|
||||
@@ -182,7 +182,7 @@ router.get('/map', async (req, res) => {
|
||||
});
|
||||
|
||||
// GET /api/devices/:id - Get specific device
|
||||
router.get('/:id', async (req, res) => {
|
||||
router.get('/:id', authenticateToken, async (req, res) => {
|
||||
try {
|
||||
const device = await Device.findByPk(req.params.id, {
|
||||
include: [
|
||||
@@ -321,7 +321,7 @@ router.delete('/:id', authenticateToken, async (req, res) => {
|
||||
});
|
||||
|
||||
// GET /api/devices/pending - List devices pending approval
|
||||
router.get('/pending', async (req, res) => {
|
||||
router.get('/pending', authenticateToken, async (req, res) => {
|
||||
try {
|
||||
const pendingDevices = await Device.findAll({
|
||||
where: { is_approved: false },
|
||||
|
||||
Reference in New Issue
Block a user