npm install
npm run serve
Note: You can also find API url and API key inside the file below:
src/Common/api.config.js
- Sort top drugs by position.
drugTopList(){
return this.getTopDrugsList
}
Note: You can find the top drug data inside this file below.
src/assets/data/topdrugs.data.js
- Use the drug service API to get drug option.
- Example: Right now after the top drug is clicked and routered to the DrugOption the
drugOptions
action gets called to the drug information and the data gets populated.
async drugOptions({commit}, payload){
await axios.get(`${DRUG_SERVICE_URL}options`, {params: {...payload, key: DRUG_SERVICE_KEY}}, ).then(response => {
const data = response.data;
commit('SET_SELECTED_DRUG_TYPE', payload.drug_type)
commit('SET_SELECTED_DRUG_NAMES', {drug_names: data.drug_names, ...payload})
commit('SET_SELECTED_DRUG_FORMS', Object.values(data.data.forms))
commit('SET_SELECTED_DRUG_STRENGTH', Object.values(data.data.strengths))
commit('SET_SELECTED_DRUG_QUANTITY', Object.values(data.data.quantities))
})
}
*Todo: On Drug Type changed called the Drug Service API(options)
again passing the new drug_type and populate the new forms, strength and quantity for the new type of drug.
Note: the drug_type param in the url was changed from `G`(Generic) to `B`(Branch).
The Drug type change event can be found inside: `src/Views/DrugTypeOptionsPicker.vue`
-
Drug API option
drugOptions
called every time the page getsactivated
, how can you prevent it from happening when the page is getting pushed by the back button of one of those option picker pages.src/Views/DrugTypeOptionsPicker.vue
src/Views/DrugFormOptionsPicker.vue
src/Views/DrugStrengthOptionsPicker.vue
src/Views/DrugQuantityOptionsPicker.vue
Note: If you notice the value you picked for the form inside the form picker will change after you click the back button to go back to the drugOption Page.
-
Get Drug Prices from API
DRUG SERVICE API PRICES
On
The Show Saving
button click call theDRUG SERVICE API PRICES
and redirect the user to thedrug_prices
page.You can find the button action inside
src/Views/DrugOption.vue
Note: the ndc value for the URL param comes from
strength ndc
-
Refactor any code that you see that is repeating it self. DRY.