diff --git a/apps/wallet/src/composables/request.composable.ts b/apps/wallet/src/composables/request.composable.ts index eceda4633..ed4f0db9a 100644 --- a/apps/wallet/src/composables/request.composable.ts +++ b/apps/wallet/src/composables/request.composable.ts @@ -21,7 +21,9 @@ export type AvailableDomain = { types: ListRequestsOperationType[]; }; -export const useAvailableDomains = (): Ref => { +export const useAvailableDomains = ( + opts: { filterBy?: RequestDomains[] } = {}, +): Ref => { const domains: Ref = ref([]); domains.value.push({ id: RequestDomains.All, @@ -86,6 +88,11 @@ export const useAvailableDomains = (): Ref => { ], }); + const filterBy = opts?.filterBy ?? []; + if (filterBy.length) { + domains.value = domains.value.filter(domain => filterBy.includes(domain.id)); + } + return domains; }; diff --git a/apps/wallet/src/pages/RequestsPage.vue b/apps/wallet/src/pages/RequestsPage.vue index 138a53a0c..1f95c105a 100644 --- a/apps/wallet/src/pages/RequestsPage.vue +++ b/apps/wallet/src/pages/RequestsPage.vue @@ -173,7 +173,7 @@ const props = withDefaults(defineProps(), { const i18n = useI18n(); const pageTitle = computed(() => props.title || i18n.t('pages.requests.title')); const station = useStationStore(); -const availableDomains = useAvailableDomains(); +const availableDomains = useAvailableDomains({ filterBy: props.domains }); const statuses = useRequestStatusItems(); const filterUtils = useFilterUtils(); const disableRefresh = ref(false); @@ -200,7 +200,9 @@ const slideGroupIdIndex = ref( watch( slideGroupIdIndex, index => { - filters.value.groupBy = availableDomains.value[index].id ?? RequestDomains.All; + const fallbackDomain = props.domains.length ? props.domains[0] : RequestDomains.All; + + filters.value.groupBy = availableDomains.value?.[index]?.id ?? fallbackDomain; }, { immediate: true }, );