Skip to content

Commit

Permalink
feat: adds 404 for malformed tokens & pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodressel authored and mmpetarpeshev committed Jun 25, 2024
1 parent 6114347 commit 2744562
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/views/PoolDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ export default defineComponent({
this.pair = await this.$store.dispatch('backend/fetchPairDetails', {
pairAddress: this.pairId,
});
if (!this.pair) {
this.loading = false;
// redirect to 404
this.$router.push({ name: 'not-found' });
return;
}
this.pair = {
...this.pair,
token0: detectAndModifyWAE(this.pair.token0),
Expand Down
14 changes: 8 additions & 6 deletions src/views/TokenDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,16 @@ export default defineComponent({
...metaInfo,
address: this.tokenId,
});
if (this.metaInfo.isAe) {
this.metaInfo = {
...this.metaInfo,
event_supply: 0, //
};
}
this.pairs = await this.$store.dispatch('backend/fetchPairsByToken', this.tokenId);
if (!this.pairs) {
this.loading = false;
// redirect to 404
this.$router.push({ name: 'not-found' });
return;
}
this.pairMap = new Map([
...this.pairs.pairs0.map((pair) => [
pair.address,
Expand Down

0 comments on commit 2744562

Please sign in to comment.