Skip to content

Commit

Permalink
feat(cache-client): update cache client interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Harasz committed Jan 5, 2022
1 parent b796515 commit 78f4517
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
Expand Up @@ -761,13 +761,12 @@ ___

### requestClaim

**requestClaim**(`requester`, `message`): `Promise`<`void`\>
**requestClaim**(`message`): `Promise`<`void`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `requester` | `string` |
| `message` | [`IClaimRequest`](../interfaces/modules_claims_claims_types.IClaimRequest.md) |

#### Returns
Expand Down
Expand Up @@ -550,13 +550,12 @@ ___

### requestClaim

**requestClaim**(`requester`, `message`): `Promise`<`void`\>
**requestClaim**(`message`): `Promise`<`void`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `requester` | `string` |
| `message` | [`IClaimRequest`](modules_claims_claims_types.IClaimRequest.md) |

#### Returns
Expand Down
2 changes: 1 addition & 1 deletion src/modules/cacheClient/ICacheClient.ts
Expand Up @@ -33,7 +33,7 @@ export interface ICacheClient {
getClaimsByRequester: (requester: string, filter?: ClaimsFilter) => Promise<Claim[]>;
getClaimsBySubject: (subject: string, filter?: ClaimsFilter) => Promise<Claim[]>;
getClaimById: (claimId: string) => Promise<Claim | undefined>;
requestClaim: (requester: string, message: IClaimRequest) => Promise<void>;
requestClaim: (message: IClaimRequest) => Promise<void>;
issueClaim: (issuer: string, message: IClaimIssuance) => Promise<void>;
rejectClaim: (issuer: string, message: IClaimRejection) => Promise<void>;
deleteClaim: (claimId: string) => Promise<void>;
Expand Down
10 changes: 5 additions & 5 deletions src/modules/cacheClient/cacheClient.service.ts
Expand Up @@ -77,9 +77,9 @@ export class CacheClient implements ICacheClient {

/**
* @description Interceptor of authentication errors. Queues failed requests and starts authentication process.
*
*
* @param error Intercepted response from failed request
*
*
* @returns Promise, which resolves with result of resending of failed request
*/
async handleError(error: AxiosError) {
Expand Down Expand Up @@ -110,7 +110,7 @@ export class CacheClient implements ICacheClient {
}

/**
* Verifies current session and establishes new one if needed
* Verifies current session and establishes new one if needed
* https://energyweb.atlassian.net/wiki/spaces/MYEN/pages/2303295607/ICL-+ICS+Auth+Process
*/
async login() {
Expand Down Expand Up @@ -242,8 +242,8 @@ export class CacheClient implements ICacheClient {
return data;
}

async requestClaim(requester: string, message: IClaimRequest) {
await this.httpClient.post<void>(`/claim/request/${requester}`, message);
async requestClaim(message: IClaimRequest) {
await this.httpClient.post<void>("/claim/request", message);
}

async issueClaim(issuer: string, message: IClaimIssuance) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/claims/claims.service.ts
Expand Up @@ -180,7 +180,7 @@ export class ClaimsService {
message.subjectAgreement = await this.approveRolePublishing({ subject, role, version });
}

await this._cacheClient.requestClaim(subject, message);
await this._cacheClient.requestClaim(message);
}

/**
Expand Down

0 comments on commit 78f4517

Please sign in to comment.