Skip to content

Commit

Permalink
- app version = 4.9.1 (#573)
Browse files Browse the repository at this point in the history
- imported latest Business Lookup shared component
- misc cleanup
- renamed getters and session storage key to better match environment key names

Co-authored-by: Severin Beauvais <severin.beauvais@gov.bc.ca>
  • Loading branch information
severinbeauvais and Severin Beauvais authored Jun 5, 2024
1 parent b30c9aa commit 31f470e
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 28 deletions.
37 changes: 30 additions & 7 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-edit-ui",
"version": "4.9.0",
"version": "4.9.1",
"private": true,
"appName": "Edit UI",
"sbcName": "SBC Common Components",
Expand All @@ -18,7 +18,7 @@
"@bcrs-shared-components/approval-type": "1.0.19",
"@bcrs-shared-components/base-address": "2.0.3",
"@bcrs-shared-components/breadcrumb": "2.1.5",
"@bcrs-shared-components/business-lookup": "1.1.30",
"@bcrs-shared-components/business-lookup": "1.3.4",
"@bcrs-shared-components/certify": "2.1.5",
"@bcrs-shared-components/completing-party": "2.1.30",
"@bcrs-shared-components/confirm-dialog": "1.2.1",
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/FileUploadPdf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ export default class FileUploadPdf extends Vue {
const psu = await this.getPresignedUrl(file.name)
// NB: will throw on API error
const res = await this.uploadToUrl(psu.preSignedUrl, file, psu.key,
this.userId)
const res = await this.uploadToUrl(psu.preSignedUrl, file, psu.key, this.userId)
// check if successful
if (res?.status === 200) {
Expand Down
14 changes: 7 additions & 7 deletions src/services/business-lookup-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { AxiosInstance as axios } from '@/utils/'
* Class that provides integration with the BusinessLookup API.
*/
export default class BusinessLookupServices {
/** The Business API URL, from session storage. */
static get businessApiUrl (): string {
/** The Registries Search API URL, from session storage. */
static get searchApiUrl (): string {
return sessionStorage.getItem('REGISTRIES_SEARCH_API_URL')
}

/** The Business API Key, from session storage. */
static get businessApiKey (): string {
return sessionStorage.getItem('BUSINESS_API_KEY')
/** The Registries Search API Key, from session storage. */
static get searchApiKey (): string {
return sessionStorage.getItem('REGISTRIES_SEARCH_API_KEY')
}

/** The Account ID, from session storage. */
Expand All @@ -36,13 +36,13 @@ export default class BusinessLookupServices {
static async search (query: string, status: string): Promise<BusinessLookupResultIF[]> {
const legalType = 'BC,A,ULC,C,S,XP,GP,LP,CUL,XS,LLC,LL,BEN,CP,CC,XL,FI,XCP,PA'

let url = this.businessApiUrl + 'businesses/search/facets?start=0&rows=20'
let url = this.searchApiUrl + 'businesses/search/facets?start=0&rows=20'
url += `&categories=legalType:${legalType}${status ? '::status:' + status : ''}`
url += `&query=value:${encodeURIComponent(query)}`

return axios.get(url, {
headers: {
'x-apikey': this.businessApiKey,
'x-apikey': this.searchApiKey,
'Account-Id': this.accountId
}
}).then(response => {
Expand Down
14 changes: 7 additions & 7 deletions src/services/legal-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ export default class LegalServices {
}

/**
* Uploads the specified file to the specified URL.
* @param url the URL to upload to
* @param file the file to upload
* @param key the file key
* @param userId the file user id
* @returns the axios response
*/
* Uploads the specified file to the specified URL.
* @param url the URL to upload to
* @param file the file to upload
* @param key the file key
* @param userId the file user id
* @returns the axios response
*/
static async uploadToUrl (url: string, file: File, key: string, userId: string): Promise<AxiosResponse> {
const headers = {
'Content-Type': file.type,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/FetchConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export async function FetchConfig (): Promise<any> {
(import.meta.env.VUE_APP_REGISTRIES_SEARCH_API_URL + import.meta.env.VUE_APP_REGISTRIES_SEARCH_API_VERSION + '/')
sessionStorage.setItem('REGISTRIES_SEARCH_API_URL', registriesSearchApiUrl)

const businessApiKey: string = import.meta.env.VUE_APP_REGISTRIES_SEARCH_API_KEY
sessionStorage.setItem('BUSINESS_API_KEY', businessApiKey)
const registriesSearchApiKey: string = import.meta.env.VUE_APP_REGISTRIES_SEARCH_API_KEY
sessionStorage.setItem('REGISTRIES_SEARCH_API_KEY', registriesSearchApiKey)

const authApiUrl: string = (import.meta.env.VUE_APP_AUTH_API_URL + import.meta.env.VUE_APP_AUTH_API_VERSION + '/')
sessionStorage.setItem('AUTH_API_URL', authApiUrl)
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/FetchConfig.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable max-len */

import { AxiosInstance, FetchConfig } from '@/utils'

// mock the console.info function to hide the output
Expand Down Expand Up @@ -47,12 +49,13 @@ describe('Fetch Config', () => {
// verify data
expect(sessionStorage.getItem('AUTH_API_URL')).toBe('auth api url/auth api version/')
expect(sessionStorage.getItem('AUTH_WEB_URL')).toBe('auth web url')
expect(sessionStorage.getItem('BUSINESS_API_KEY')).toBe('business api key')
expect(sessionStorage.getItem('BUSINESSES_URL')).toBe('businesses url')
expect(sessionStorage.getItem('DASHBOARD_URL')).toBe('dashboard url')
expect(sessionStorage.getItem('NAICS_URL')).toBe('naics api url/naics api version/')
expect(sessionStorage.getItem('PAY_API_URL')).toBe('pay api url/pay api version/')
expect(sessionStorage.getItem('REGISTRY_HOME_URL')).toBe('registry home url')
expect(sessionStorage.getItem('REGISTRIES_SEARCH_API_KEY')).toBe('business api key')
expect(sessionStorage.getItem('REGISTRIES_SEARCH_API_URL')).toBe('registries search api url/registries search api version/')
expect(sessionStorage.getItem('SITEMINDER_LOGOUT_URL')).toBe('siteminder logout url')
expect(sessionStorage.getItem('STATUS_API_URL')).toBe('status api url/status api version')
expect(AxiosInstance.defaults.baseURL).toBe('legal api url/legal api version 2/')
Expand Down

0 comments on commit 31f470e

Please sign in to comment.