mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(pending post): page could redirect to "not found" if pending post failed
This commit is contained in:
@@ -14,10 +14,13 @@ const PendingPost = () => {
|
|||||||
|
|
||||||
const isValidAccountCommentIndex =
|
const isValidAccountCommentIndex =
|
||||||
!accountCommentIndex ||
|
!accountCommentIndex ||
|
||||||
|
// Check if it's a valid positive integer
|
||||||
(!isNaN(parseInt(accountCommentIndex)) &&
|
(!isNaN(parseInt(accountCommentIndex)) &&
|
||||||
parseInt(accountCommentIndex) >= 0 &&
|
parseInt(accountCommentIndex) >= 0 &&
|
||||||
accountComments?.length > 0 &&
|
Number.isInteger(parseFloat(accountCommentIndex)) &&
|
||||||
parseInt(accountCommentIndex) < accountComments.length);
|
// Allow index to be at most 1 position beyond the current length
|
||||||
|
// This handles the case where a new post is being created
|
||||||
|
(accountComments?.length === 0 || parseInt(accountCommentIndex) <= accountComments.length));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isValidAccountCommentIndex) {
|
if (!isValidAccountCommentIndex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user