Skip to content

Commit

Permalink
add account id header (bcgov#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
vysakh-menon-aot authored Jan 9, 2024
1 parent 54cccc5 commit 65c7316
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-create-ui",
"version": "5.6.29",
"version": "5.6.30",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down
15 changes: 14 additions & 1 deletion src/services/legal-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export default class LegalServices {
url += '?draft=true'
}

return axios.put(url, { filing }).then(response => {
return axios.put(url, { filing },
{ headers: { 'Account-Id': this.accountId } }).then(response => {
const filing = response?.data?.filing
const filingId = +filing?.header?.filingId || 0

Expand All @@ -139,6 +140,18 @@ export default class LegalServices {
// NB: for error handling, see "save-error-event"
}

/** The Account ID, from session storage. */
static get accountId (): string {
// if we can't get account id from ACCOUNT_ID
// then try to get it from CURRENT_ACCOUNT
let accountId = sessionStorage.getItem('ACCOUNT_ID')
if (!accountId) {
const currentAccount = sessionStorage.getItem('CURRENT_ACCOUNT')
accountId = JSON.parse(currentAccount)?.id
}
return accountId
}

/**
* Fetches name request data with phone and email validation.
* @param nrNumber the name request number (eg, NR 1234567)
Expand Down

0 comments on commit 65c7316

Please sign in to comment.