From 266b468f95b26cec4b61c4e5e6054571038d7e8f Mon Sep 17 00:00:00 2001 From: Hakan Bilgin Date: Mon, 23 Nov 2020 16:20:00 +0100 Subject: [PATCH] fixes #25 --- package.json | 8 +------- src/api/ApiMethod.js | 4 ++-- src/oauth/index.js | 4 ++-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 83e9ce3..a029707 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,7 @@ "flow": "flow", "test": "yarn test-only", "test-only": "jest --coverage --colors", - "test:watch": "jest --colors --watch", - "precommit": "lint-staged" + "test:watch": "jest --colors --watch" }, "engineStrict": true, "engines": { @@ -97,11 +96,6 @@ "ENV": "node" } }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, "lint-staged": { "*.js": [ "eslint" diff --git a/src/api/ApiMethod.js b/src/api/ApiMethod.js index 640d6ea..0acbb02 100644 --- a/src/api/ApiMethod.js +++ b/src/api/ApiMethod.js @@ -20,10 +20,10 @@ export default function ApiMethod(method: string, options: ApiMethodOptions = {} !isAuthMethod(method) || "auth" in params || "access_token" in params || "username" in params, "`auth` must be present for methods that require authentication." ); - + const requestUrl: string = url.format({ protocol: apiProtocol, - host: locations[locationid] || apiServer, + host: params.hostname || apiServer, pathname: method, query: params, }); diff --git a/src/oauth/index.js b/src/oauth/index.js index ba2570e..313815a 100644 --- a/src/oauth/index.js +++ b/src/oauth/index.js @@ -103,9 +103,9 @@ function popup() { } } -function getTokenFromCode(code: string, client_id: string, app_secret: string) { +function getTokenFromCode(code: string, hostname: string, client_id: string, app_secret: string) { return ApiMethod("oauth2_token", { - params: { client_id: client_id, client_secret: app_secret, code: code }, + params: { client_id: client_id, client_secret: app_secret, code: code, hostname: hostname }, }); }