I was wondering whether this was a safe way to render certain elements only for specific pubkeys when connected through Solana wallet adapter in Nextjs. This code returns an < AdminPanel /> when we are logged in with one of the pubkeys in adminList[].
import { useWallet } from '@solana/wallet-adapter-react';
const { publicKey } = useWallet();
if (publicKey.toBase58() === adminList[1].publickey)
) {
return ( <AdminPanel /> ); }
else {
return ( <UserPanel /> ) ; }
I realize I have to protect my api routes as well when fetching data, but would it be possible for someone with bad intentions to access the AdminPanel element without being logged in with one of the pubkeys in the adminList[] array?
Thanks in advance!