change route for ibc

This commit is contained in:
Pham Tu 2024-02-17 18:30:14 +07:00
parent 6387cb491c
commit 688d04e739
No known key found for this signature in database
GPG Key ID: 7460FD99133ADA1C
3 changed files with 23 additions and 34 deletions

View File

@ -1,16 +1,12 @@
<script lang="ts" setup>
import PaginationBar from '@/components/PaginationBar.vue';
import { useBlockchain, useFormatter } from '@/stores';
import { PageRequest, type Connection, type Pagination } from '@/types';
import { computed, onMounted } from 'vue';
import { ref } from 'vue';
import { useBlockchain } from '@/stores';
import { PageRequest } from '@/types';
import { onMounted, ref } from 'vue';
import ChainRegistryClient from '@ping-pub/chain-registry-client';
import type { IBCPath } from '@ping-pub/chain-registry-client/dist/types';
import router from '@/router';
import { useIBCModule } from './connStore';
import type { PageResponse } from 'cosmjs-types/cosmos/base/query/v1beta1/pagination';
import type { IdentifiedConnection } from 'cosmjs-types/ibc/core/connection/v1/connection';
import { useRoute } from 'vue-router';
import { useIBCModule } from './connStore';
const props = defineProps(['chain']);
const chainStore = useBlockchain();
@ -19,6 +15,7 @@ const list = ref([] as IdentifiedConnection[]);
const pageRequest = ref(new PageRequest());
const pageResponse = ref({} as PageResponse | undefined);
const tab = ref('registry');
const route = useRoute();
onMounted(() => {
pageload(1);
@ -31,7 +28,8 @@ function pageload(p: number) {
list.value = x.connections;
pageResponse.value = x.pagination;
if (x.pagination?.total && Number(x.pagination.total) > 0) {
ibcStore.showConnection(0);
const connId = route.params.connection_id as string;
ibcStore.showConnection(connId || 0);
}
});
}

View File

@ -1,30 +1,18 @@
<script lang="ts" setup>
import PaginationBar from '@/components/PaginationBar.vue';
import type { ExtraTxSearchResponse } from '@/libs/client';
import { formatSeconds } from '@/libs/utils';
import { useBaseStore, useBlockchain, useFormatter } from '@/stores';
import {
type Connection,
type ClientState,
type Channel,
PageRequest,
type TxResponse,
type PaginatedTxs,
} from '@/types';
import { computed, onMounted } from 'vue';
import { ref } from 'vue';
import { useIBCModule } from '../connStore';
import PaginationBar from '@/components/PaginationBar.vue';
import { PageRequest } from '@/types';
import { toHex } from '@cosmjs/encoding';
import { Icon } from '@iconify/vue';
import type { ConnectionEnd } from 'cosmjs-types/ibc/core/connection/v1/connection';
import type { IdentifiedClientState } from 'cosmjs-types/ibc/core/client/v1/client';
import type { IdentifiedChannel } from 'cosmjs-types/ibc/core/channel/v1/channel';
import {
ClientState as TendermintClientState,
ConsensusState as TendermintConsensusState,
} from 'cosmjs-types/ibc/lightclients/tendermint/v1/tendermint';
import { State } from 'cosmjs-types/ibc/core/channel/v1/channel';
import type { TxSearchResponse } from '@cosmjs/tendermint-rpc';
import { toBase64, toHex } from '@cosmjs/encoding';
import type { ExtraTxSearchResponse } from '@/libs/client';
import type { IdentifiedClientState } from 'cosmjs-types/ibc/core/client/v1/client';
import type { ConnectionEnd } from 'cosmjs-types/ibc/core/connection/v1/connection';
import { ClientState as TendermintClientState } from 'cosmjs-types/ibc/lightclients/tendermint/v1/tendermint';
import { computed, onMounted, ref } from 'vue';
import { useIBCModule } from '../connStore';
const props = defineProps(['chain', 'connection_id']);
const chainStore = useBlockchain();

View File

@ -1,8 +1,11 @@
<script lang="ts" setup>
// router.push(`/${props.chain}/ibc/connection/connection-0`)
import { useRouter } from 'vue-router';
const props = defineProps(['chain']);
const router = useRouter();
router.push(`/${props.chain}/ibc/connection/connection-0`);
</script>
<template>
<div></div>
<div></div>
</template>
<route>
{
@ -11,4 +14,4 @@
order: 9
}
}
</route>
</route>