Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
feat: revert
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgraham4401 committed Jul 12, 2021
1 parent 8ce7a79 commit 4df80fa
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 8 deletions.
23 changes: 22 additions & 1 deletion lib/haztrak.js
Original file line number Diff line number Diff line change
Expand Up @@ -16030,14 +16030,35 @@ async function siteMtn (siteId) {
}
}

/**
* Revert manifest under correction to previous version
*
* @param {string} mtn manifest tracking number (MTN)
* */
async function eManRevert (mtn) {
try {
const res = await axiosGet({
url: `/emanifest/manifest/revert/${mtn}`,
headers: {
Accept: 'application/json'
}
});
return res.data
} catch (error) {
console.error(`Problem reverting ${mtn}`);
console.error(error.message);
}
}

var eManServices = /*#__PURE__*/Object.freeze({
__proto__: null,
get: eManGet,
save: eManSave,
'delete': eManDel,
sites: eManSites,
exists: mtnExists,
siteMtn: siteMtn
siteMtn: siteMtn,
revert: eManRevert
});

// lookServ.js
Expand Down
25 changes: 24 additions & 1 deletion src/eManServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,27 @@ async function siteMtn (siteId) {
}
}

export { eManGet as get, eManSave as save, eManDel as delete, eManSites as sites, mtnExists as exists, siteMtn }
/**
* Revert manifest under correction to previous version
*
* @param {string} mtn manifest tracking number (MTN)
* */
async function eManRevert (mtn) {
try {
const res = await eManAPI.get({
url: `/emanifest/manifest/revert/${mtn}`,
headers: {
Accept: 'application/json'
}
})
return res.data
} catch (error) {
console.error(`Problem reverting ${mtn}`)
console.error(error.message)
}
}

export {
eManGet as get, eManSave as save, eManDel as delete,
eManSites as sites, mtnExists as exists, siteMtn, eManRevert as revert
}
18 changes: 12 additions & 6 deletions test/scratchTest.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import haztrak from '../index.js'
const fooBar = async () => {
const stateCode = 'VA'
const siteType = 'tsdf'
const res = await haztrak.eMan.sites(stateCode, siteType)
console.log(res)
}
// const fooBar = async () => {
// const stateCode = 'VA'
// const siteType = 'tsdf'
// const res = await haztrak.eMan.sites(stateCode, siteType)
// console.log(res)
// }

// const fooBar = async () => {
// const mtn = '100032135ELC'
Expand All @@ -17,4 +17,10 @@ const fooBar = async () => {
// const res = await haztrak.eMan.siteMtn(siteId)
// console.log(res)
// }

const fooBar = async () => {
const mtn = '100030514ELC'
const res = await haztrak.eMan.revert(mtn)
console.log(res)
}
fooBar()

0 comments on commit 4df80fa

Please sign in to comment.