Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
5ccd3232
Commit
5ccd3232
authored
Jan 16, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix block and tx page errors
parent
6e48647c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
BlockDetails.tsx
ui/block/BlockDetails.tsx
+4
-4
Page.tsx
ui/shared/Page/Page.tsx
+1
-1
TxDetails.tsx
ui/tx/TxDetails.tsx
+3
-3
No files found.
ui/block/BlockDetails.tsx
View file @
5ccd3232
...
@@ -31,7 +31,7 @@ const BlockDetails = () => {
...
@@ -31,7 +31,7 @@ const BlockDetails = () => {
const
[
isExpanded
,
setIsExpanded
]
=
React
.
useState
(
false
);
const
[
isExpanded
,
setIsExpanded
]
=
React
.
useState
(
false
);
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
data
,
isLoading
,
isError
,
error
}
=
useApiQuery
<
'
block
'
,
{
status
:
number
}
>
(
'
block
'
,
{
const
{
data
,
isLoading
,
isError
,
error
}
=
useApiQuery
(
'
block
'
,
{
pathParams
:
{
id
:
router
.
query
.
id
?.
toString
()
},
pathParams
:
{
id
:
router
.
query
.
id
?.
toString
()
},
queryOptions
:
{
enabled
:
Boolean
(
router
.
query
.
id
)
},
queryOptions
:
{
enabled
:
Boolean
(
router
.
query
.
id
)
},
});
});
...
@@ -59,11 +59,11 @@ const BlockDetails = () => {
...
@@ -59,11 +59,11 @@ const BlockDetails = () => {
}
}
if
(
isError
)
{
if
(
isError
)
{
if
(
error
?.
payload
?.
status
===
404
)
{
if
(
error
?.
status
===
404
)
{
return
<
span
>
This block has not been processed yet.
</
span
>
;
throw
Error
(
'
Block not found
'
,
{
cause
:
error
as
unknown
as
Error
})
;
}
}
if
(
error
?.
payload
?.
status
===
422
)
{
if
(
error
?.
status
===
422
)
{
throw
Error
(
'
Invalid block number
'
,
{
cause
:
error
as
unknown
as
Error
});
throw
Error
(
'
Invalid block number
'
,
{
cause
:
error
as
unknown
as
Error
});
}
}
...
...
ui/shared/Page/Page.tsx
View file @
5ccd3232
...
@@ -52,7 +52,7 @@ const Page = ({
...
@@ -52,7 +52,7 @@ const Page = ({
const
renderErrorScreen
=
React
.
useCallback
((
error
?:
Error
)
=>
{
const
renderErrorScreen
=
React
.
useCallback
((
error
?:
Error
)
=>
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const
statusCode
=
(
error
?.
cause
as
any
)?.
error
?.
status
||
500
;
const
statusCode
=
(
error
?.
cause
as
any
)?.
status
||
500
;
const
isInvalidTxHash
=
error
?.
message
.
includes
(
'
Invalid tx hash
'
);
const
isInvalidTxHash
=
error
?.
message
.
includes
(
'
Invalid tx hash
'
);
if
(
wrapChildren
)
{
if
(
wrapChildren
)
{
...
...
ui/tx/TxDetails.tsx
View file @
5ccd3232
...
@@ -68,12 +68,12 @@ const TxDetails = () => {
...
@@ -68,12 +68,12 @@ const TxDetails = () => {
}
}
if
(
isError
)
{
if
(
isError
)
{
if
(
error
?.
payload
?.
status
===
422
)
{
if
(
error
?.
status
===
422
)
{
throw
Error
(
'
Invalid tx hash
'
,
{
cause
:
error
as
unknown
as
Error
});
throw
Error
(
'
Invalid tx hash
'
,
{
cause
:
error
as
unknown
as
Error
});
}
}
if
(
error
?.
payload
?.
status
===
404
)
{
if
(
error
?.
status
===
404
)
{
throw
Error
(
'
Tx
fetch faile
d
'
,
{
cause
:
error
as
unknown
as
Error
});
throw
Error
(
'
Tx
not foun
d
'
,
{
cause
:
error
as
unknown
as
Error
});
}
}
return
<
DataFetchAlert
/>;
return
<
DataFetchAlert
/>;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment