Skip to content

Commit

Permalink
[#21] Move base URL from auth adapter to base adapter as common for e…
Browse files Browse the repository at this point in the history
…ntirely of application
  • Loading branch information
liamstevens111 committed Feb 17, 2023
1 parent cec25c0 commit bfc3f7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/adapters/authAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AuthAdapter extends BaseAdapter {
};
/* eslint-enable camelcase */

return this.prototype.postRequest(`${process.env.REACT_APP_API_ENDPOINT}/oauth/token`, { data: requestParams });
return this.prototype.postRequest('oauth/token', { data: requestParams });
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/adapters/baseAdapter..ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import requestManager, { RequestParamsType } from 'lib/requestManager';

class BaseAdapter {
static baseUrl = process.env.REACT_APP_API_ENDPOINT;

getRequest(endpoint: string, params: RequestParamsType) {
return requestManager('GET', endpoint, params);
return requestManager('GET', `${BaseAdapter.baseUrl}/${endpoint}`, params);
}

postRequest(endpoint: string, params: RequestParamsType) {
return requestManager('POST', endpoint, params);
return requestManager('POST', `${BaseAdapter.baseUrl}/${endpoint}`, params);
}
}

Expand Down

0 comments on commit bfc3f7d

Please sign in to comment.