Edit UI: Use VueRouter to pass the businessID to views
- 主要言語
- JavaScript
- スター
- 23
- フォーク
- 62
- 平均マージ
- 24分
- マージ済み PR(30日)
- 1
説明
## What is the problem?
At present, we're not using VueRouter to pass the businessID to the views as property. Instead, we're using a non-standard approach that uses custom code, from a function called `fetchConfig()` called from App.vue. Like this:
```javascript
// get Business ID and validate that it looks OK
// it should be first token after Base URL in Pathname
// FUTURE: improve Business ID validation
const id = windowLocationPathname.replace(processEnvBaseUrl, '').split('/', 1)[0]
const businessIdRegex = /^(BC|C|CP|FM)\d{7}$/
if (businessIdRegex.test(id)) { // Allow corps/firms/coop
sessionStorage.setItem('BUSINESS_ID', id)
} else {
return Promise.reject(new Error('Missing or invalid Business ID.'))
}
```
## What is the impact?
A custom solution to pass the businessID to Vue:
- makes onboarding new developers more difficult
- requires additional testing and documentation
- may have undiscovered security weaknesses
## Proposed solution
Use VueRouter's beautiful, declarative syntax to handle the businessID instead like this:
```javascript
{
path: '/businesses/edit/:businessId/limitedRestorationExtension',
name: RouteNames.LIMITED_RESTORATION_EXTENSION,
component: LimitedRestorationExtension,
props: true
},
```
Then in the view component, `businessId` is available as a prop. The businessId validation should be performed by a "navigation guard" inside VueRouter.
See: https://v3.router.vuejs.org/guide/essentials/passing-props.html
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
App.vue から始め、BUSINESS_ID を抽出して保存するカスタム fetchConfig() フローをたどります。既存の VueRouter のルート定義と、リンクされている VueRouter の props の受け渡しに関するガイダンスを確認します。完了条件は、ビューが route props を通じて businessId を受け取り、検証がカスタム sessionStorage フローではなく navigation guard によって処理されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- frontend
- issue の種類
- リファクタリング
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 32/100