Skip to content

Commit

Permalink
feat(applets.js): [CMP-265] Added docstrings detailing the alerts obj…
Browse files Browse the repository at this point in the history
…ect, updated variable handling in getAppletsforTarget
  • Loading branch information
tropotorres authored and orvisevans committed Nov 3, 2023
1 parent 28cebd9 commit f1d4e85
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/stores/applets.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ export const useAppletsStore = defineStore('applets', () => {
* @param {string} [options.loadingMessage] message to display while loading
* @param {string} [options.loadedMessage] message to display when loaded
* @param {string} [options.errorMessage] message to display on error
*
* @param {object} [alerts]
* @param {function} [alerts.addInfoAlert] function to handle info alerts (display the loadingMessage from options)
* @param {function} [alerts.addErrorAlert] function to handle error alerts (takes errorMessage and an error event)
* @param {function} [alerts.addSuccessAlert] function to handle success alerts (display the loadedMessage from options)
* @param {function} [alerts.removeAlertById] function to handle removing alerts by id. Important when using an alerts store/component
*/
const fetchApplets = async (api, alerts = {}, options = {}) => {
if (hasLoaded.value || isLoading.value) return
Expand Down Expand Up @@ -173,9 +179,10 @@ export const useAppletsStore = defineStore('applets', () => {
* @param {import('vue').MaybeRefOrGetter<string>} targetArea or 'all'
* @returns {Applet[]}
*/
const getAppletsForTarget = (targetPage, targetArea, appletId = undefined) => {
const getAppletsForTarget = (targetPage, targetArea, targetAppletId = undefined) => {
const page = toValue(targetPage)
const area = toValue(targetArea)
const appletId = toValue(targetAppletId)
const allPossibleTargetApplets = [
...(appletsMap.value[page]?.[area] || []),
...(appletsMap.value[page]?.all || []),
Expand Down

0 comments on commit f1d4e85

Please sign in to comment.