X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=inline;f=resources%2Fjs%2Fpages%2FEvent.js;h=fa5dc2163c30c3432356857dbfa330fa153c28ff;hb=3213c82ad2dd75e313d15423e25653596c7ce278;hp=c7f0ce55d228939ba93d5997cc019e38f517fbd4;hpb=3544909490592e8c2387f3347ee5e12a8c0414be;p=alttp.git
diff --git a/resources/js/pages/Event.js b/resources/js/pages/Event.js
index c7f0ce5..fa5dc21 100644
--- a/resources/js/pages/Event.js
+++ b/resources/js/pages/Event.js
@@ -3,7 +3,7 @@ import moment from 'moment';
import React from 'react';
import { Container } from 'react-bootstrap';
import { Helmet } from 'react-helmet';
-import { withTranslation } from 'react-i18next';
+import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import toastr from 'toastr';
@@ -20,13 +20,14 @@ import {
mayEditContent,
} from '../helpers/permissions';
import { getTranslation } from '../helpers/Technique';
-import { useUser } from '../helpers/UserContext';
+import { useUser } from '../hooks/user';
import i18n from '../i18n';
-const Event = () => {
+export const Component = () => {
const params = useParams();
const { name } = params;
- const user = useUser();
+ const { user } = useUser();
+ const { t } = useTranslation();
const [error, setError] = React.useState(null);
const [loading, setLoading] = React.useState(true);
@@ -76,14 +77,14 @@ const Event = () => {
parent_id: event.description_id,
...values,
});
- toastr.success(i18n.t('content.saveSuccess'));
+ toastr.success(t('content.saveSuccess'));
setEvent(event => ({
...event,
description: response.data,
}));
setShowContentDialog(false);
} catch (e) {
- toastr.error(i18n.t('content.saveError'));
+ toastr.error(t('content.saveError'));
}
}, [event && event.description_id]);
@@ -149,7 +150,7 @@ const Event = () => {