Browse Source

chore: Fix some eslint issues in routers

/puter/packages/backend/src/routers/open_item.js
  48:10  error  Unexpected negating the left operand of 'instanceof' operator  no-unsafe-negation

/puter/packages/backend/src/routers/save_account.js
  106:34  error  'get_user' is not defined   no-undef

/puter/packages/backend/src/routers/sign.js
  37:10  error  Unexpected negating the left operand of 'instanceof' operator  no-unsafe-negation
Sam Atkins 1 year ago
parent
commit
ca3f9a823d

+ 1 - 1
packages/backend/src/routers/open_item.js

@@ -45,7 +45,7 @@ module.exports = eggspress('/open_item', {
     const subject = req.values.subject;
 
     const actor = Context.get('actor');
-    if ( ! actor.type instanceof UserActorType ) {
+    if ( ! (actor.type instanceof UserActorType) ) {
         throw APIError.create('forbidden');
     }
 

+ 1 - 1
packages/backend/src/routers/save_account.js

@@ -19,7 +19,7 @@
 "use strict"
 const express = require('express');
 const router = new express.Router();
-const {get_taskbar_items, username_exists, send_email_verification_code, send_email_verification_token, invalidate_cached_user} = require('../helpers');
+const {get_taskbar_items, username_exists, send_email_verification_code, send_email_verification_token, invalidate_cached_user, get_user } = require('../helpers');
 const auth = require('../middleware/auth.js');
 const config = require('../config');
 const { Context } = require('../util/context');

+ 1 - 1
packages/backend/src/routers/sign.js

@@ -34,7 +34,7 @@ module.exports = eggspress('/sign', {
     allowedMethods: ['POST'],
 }, async (req, res, next)=>{
     const actor = Context.get('actor');
-    if ( ! actor.type instanceof UserActorType ) {
+    if ( ! (actor.type instanceof UserActorType) ) {
         throw APIError.create('forbidden');
     }