X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Ftournament%2FApplyButton.js;h=8bbd98ec12556daf57572178e50781c615896a84;hb=4c5a82cb876e96c72c50e8bc12bd8a43a9afe847;hp=601eb938e5f46d4e525da90737599e9c935ebc80;hpb=d34eaa32d939ebf82a86a1d87c2162774512ef12;p=alttp.git diff --git a/resources/js/components/tournament/ApplyButton.js b/resources/js/components/tournament/ApplyButton.js index 601eb93..8bbd98e 100644 --- a/resources/js/components/tournament/ApplyButton.js +++ b/resources/js/components/tournament/ApplyButton.js @@ -7,7 +7,7 @@ import toastr from 'toastr'; import Icon from '../common/Icon'; import { isApplicant, isDeniedApplicant, isRunner, mayApply } from '../../helpers/permissions'; -import { withUser } from '../../helpers/UserContext'; +import { useUser } from '../../hooks/user'; import i18n from '../../i18n'; const apply = async tournament => { @@ -29,8 +29,10 @@ const getTitle = (user, tournament) => { return i18n.t('tournaments.apply'); }; -const ApplyButton = ({ tournament, user }) => { - if (!tournament.accept_applications || isRunner(user, tournament)) return null; +const ApplyButton = ({ tournament }) => { + const { user } = useUser(); + + if (!user || !tournament.accept_applications || isRunner(user, tournament)) return null; return