refactor: simplify authentication check in AnnuncioView component
This commit is contained in:
parent
440f3b1467
commit
d4c28117d7
1 changed files with 2 additions and 6 deletions
|
|
@ -121,16 +121,12 @@ const AnnuncioDettaglio: NextPage<AnnuncioProps> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const AnnuncioView = ({ data, flag }: AnnuncioProps) => {
|
const AnnuncioView = ({ data, flag }: AnnuncioProps) => {
|
||||||
const { status, user } = useSession();
|
const { user } = useSession();
|
||||||
useStaleImageReload();
|
useStaleImageReload();
|
||||||
|
|
||||||
const isDesktop = useMediaQuery("(min-width: 768px)");
|
const isDesktop = useMediaQuery("(min-width: 768px)");
|
||||||
|
|
||||||
if (
|
if (!data || (data && data.stato === "Sospeso")) {
|
||||||
!data ||
|
|
||||||
status !== "AUTHENTICATED" ||
|
|
||||||
(data && data.stato === "Sospeso")
|
|
||||||
) {
|
|
||||||
return <FailedAnnuncioLoading />;
|
return <FailedAnnuncioLoading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue