mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(hooks): handle pkc rebrand regressions
This commit is contained in:
@@ -2,13 +2,13 @@ import { ChallengeVerification } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import directoriesData from '../../data/5chan-directories.json';
|
||||
import { getBoardPath } from './route-utils';
|
||||
|
||||
const resolveBoardIdentifier = (subplebbitAddress: unknown): string => {
|
||||
if (typeof subplebbitAddress !== 'string' || !subplebbitAddress) {
|
||||
const resolveBoardIdentifier = (communityAddress: unknown): string => {
|
||||
if (typeof communityAddress !== 'string' || !communityAddress) {
|
||||
return 'unknown board';
|
||||
}
|
||||
|
||||
const boardPath = getBoardPath(subplebbitAddress, directoriesData.communities);
|
||||
return boardPath === subplebbitAddress ? subplebbitAddress : `/${boardPath}/`;
|
||||
const boardPath = getBoardPath(communityAddress, directoriesData.communities);
|
||||
return boardPath === communityAddress ? communityAddress : `/${boardPath}/`;
|
||||
};
|
||||
|
||||
export const alertChallengeVerificationFailed = (challengeVerification: ChallengeVerification, publication: any) => {
|
||||
@@ -35,8 +35,9 @@ export const alertChallengeVerificationFailed = (challengeVerification: Challeng
|
||||
}
|
||||
|
||||
const finalMessage = errorMessages.filter(Boolean).join(' ');
|
||||
const publicationCommunityAddress = publication?.communityAddress || publication?.subplebbitAddress;
|
||||
|
||||
alert(`Error from ${resolveBoardIdentifier(publication?.subplebbitAddress)}: ${finalMessage || 'unknown error'}`);
|
||||
alert(`Error from ${resolveBoardIdentifier(publicationCommunityAddress)}: ${finalMessage || 'unknown error'}`);
|
||||
} else {
|
||||
console.log('Challenge verification succeeded:', challengeVerification);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user