Skip to content

Commit

Permalink
fix: redirect to root when network of feed not found
Browse files Browse the repository at this point in the history
  • Loading branch information
gabaldon committed Apr 9, 2024
1 parent 095e912 commit a078642
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/ui/components/DataFeedDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const emit = defineEmits(['feed-name', 'network', 'feed-date', 'feed-value'])
const store = useStore()
const route = useRoute()
const router = useRouter()
const asyncFeedsInterval = new AsyncInterval(POLLER_MILLISECONDS)
const timestamp = ref(getTimestampByRange(CHART_RANGE.w.value))
const ranges = CHART_RANGE
Expand Down Expand Up @@ -171,6 +172,9 @@ const fetchData = async () => {
page: currentPage.value,
size: itemsPerPage.value,
})
if (!store.feed) {
router.push('/')
}
}
const chartData: Ref<AreaData<Time>[]> = computed(() => {
Expand Down
7 changes: 6 additions & 1 deletion packages/ui/components/EcosystemNetworkList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { generateNavOptions } from '../utils/generateNavOptions'
const store = useStore()
const route = useRoute()
const router = useRouter()
useServerSeoMeta({
ogTitle: () => `Witnet Data Feeds on ${currentEcosystemSeoFormat.value}`,
Expand Down Expand Up @@ -79,7 +80,11 @@ onMounted(async () => {
}
const selectedEcosystemNetworks =
ecosystemsList.value[currentEcosystem.value.toLocaleLowerCase()]
store.updateSelectedNetwork({ networks: selectedEcosystemNetworks })
if (selectedEcosystemNetworks) {
store.updateSelectedNetwork({ networks: selectedEcosystemNetworks })
} else {
router.push('/')
}
})
function updateOptions(index: number) {
store.deleteEmptyNetwork({ index })
Expand Down

0 comments on commit a078642

Please sign in to comment.