-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor corrections and code improvement
- Loading branch information
Nataniel López
committed
Apr 26, 2022
1 parent
e1ada47
commit ca922be
Showing
7 changed files
with
78 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const MicroserviceCall = require('@janiscommerce/microservice-call'); | ||
|
||
module.exports = async clientCodes => { | ||
|
||
const msCall = new MicroserviceCall(); | ||
|
||
const { statusCode, body } = await msCall.safeList('id', 'client', { filters: { clientCode: clientCodes }, limit: clientCodes.length }); | ||
|
||
if(statusCode >= 500) { | ||
const errorMessage = body && body.message ? `${body.message}` : 'Service failed'; | ||
throw new Error(`Failed to get Janis ID clients: ${errorMessage}`); | ||
} | ||
|
||
return statusCode < 400 && body.length && body; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters