Skip to content

Commit

Permalink
Merge pull request #668 from vselvarajijay/hexagonal
Browse files Browse the repository at this point in the history
cleaning up account service
  • Loading branch information
vselvarajijay committed Jun 9, 2024
2 parents 0e7abc7 + 8d51929 commit 1219478
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apps/registry/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {

import {AccountService} from '@akello/account';



interface AppProps {
isPassedToWithAuthenticator: boolean;
}
Expand Down Expand Up @@ -47,7 +45,9 @@ const App:React.FC<AppProps> = () => {

/////////////////////////
// DBUG - test the account service
const accountService = new AccountService()
const accountService = new AccountService(
import.meta.env.VITE_MICROSERVICE_ACCOUNT_API
);
accountService.getAccount(
"ACCESS_TOKEN",
"ACCOUNT_ID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# TODO : no logger here


router = APIRouter()
app_config = config.AppConfig(**config.config)
unit_of_work = dynamodb_unit_of_work.DynamoDBUnitOfWork(
Expand Down
15 changes: 11 additions & 4 deletions microservices/account/packages/account/src/lib/services/account.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@

import { BaseService } from './base';

// set values from environment variables
const BASE_URL = import.meta.env.VITE_API_URL;

export interface IAccountService {
export interface IAccountService {
getAccount(accessToken: string, accountId: string, onSuccess: (data: any) => void, onFail?: (data: any) => void): void;
}

export class AccountService extends BaseService implements IAccountService {
baseURL: string;

constructor(
baseURL: string
) {
super();
this.baseURL = baseURL;
}

async getAccount(accessToken: string, accountId: string, onSuccess: (data: any) => void, onFail?: (data: any) => void) {
// set values from environment variables
const endpoint = "account/" + accountId;
this.apiRequest({
api_url: BASE_URL!,
api_url: this.baseURL,
method: 'get',
endpoint: endpoint,
token: accessToken!,
Expand Down

0 comments on commit 1219478

Please sign in to comment.