From bf8620d75c8d04718a35fa2de52d1a5e24816784 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 4 Jun 2021 10:11:07 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20clean=20up=20change-sta?= =?UTF-8?q?te=20handler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/mirage/route-handlers/auth.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/addons/api/mirage/route-handlers/auth.js b/addons/api/mirage/route-handlers/auth.js index 5bba5d92a..6f9a51634 100644 --- a/addons/api/mirage/route-handlers/auth.js +++ b/addons/api/mirage/route-handlers/auth.js @@ -122,19 +122,18 @@ export function authHandler({ scopes, authMethods }, request) { return commandHandlers[authMethod.type][command](payload, scopeAttrs); } + // TODO: this handler doesn't really belong here, but we already route + // POST requests on existing auth methods to this route handler file under the + // assumption it would be for authentication. While authentication should + // still occur here, we should handle other custom methods in the + // mirage config and route here only for auth. if (method === 'change-state') { const attrs = this.normalizedRequestAttrs(); - let updatedAttrs = {}; - - if (method === 'change-state') { - updatedAttrs = { - attributes: { - state: attrs.attributes.state, - }, - }; - } - - return authMethod.update(updatedAttrs); + return authMethod.update({ + attributes: { + state: attrs.attributes.state, + }, + }); } }