X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fpages%2FTechnique.js;h=4004707895ad23dc18607e1af5a1758c2b01e3fa;hb=9e08a6086d2c982ec9a2b9b79e3441ac8347f695;hp=19b56b72829e3c0427505b3a2327483516c2fc54;hpb=68aabaf6da8ed6e675bdea728702d5bd75066964;p=alttp.git
diff --git a/resources/js/components/pages/Technique.js b/resources/js/components/pages/Technique.js
index 19b56b7..4004707 100644
--- a/resources/js/components/pages/Technique.js
+++ b/resources/js/components/pages/Technique.js
@@ -1,14 +1,20 @@
import axios from 'axios';
+import PropTypes from 'prop-types';
import React, { useEffect, useState } from 'react';
+import { Helmet } from 'react-helmet';
+import { withTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
+import CanonicalLinks from '../common/CanonicalLinks';
import ErrorBoundary from '../common/ErrorBoundary';
import ErrorMessage from '../common/ErrorMessage';
import Loading from '../common/Loading';
import NotFound from '../pages/NotFound';
import Detail from '../techniques/Detail';
+import { getLanguages, getMatchedLocale, getTranslation } from '../../helpers/Technique';
+import i18n from '../../i18n';
-const Technique = () => {
+const Technique = ({ type }) => {
const params = useParams();
const { name } = params;
@@ -20,12 +26,11 @@ const Technique = () => {
const ctrl = new AbortController();
setLoading(true);
axios
- .get(`/api/tech/${name}`, { signal: ctrl.signal })
+ .get(`/api/pages/${type}/${name}`, { signal: ctrl.signal })
.then(response => {
setError(null);
setLoading(false);
setTechnique(response.data);
- window.document.title = response.data.title;
})
.catch(error => {
setError(error);
@@ -35,7 +40,7 @@ const Technique = () => {
return () => {
ctrl.abort();
};
- }, [name]);
+ }, [name, type]);
if (loading) {
return ;
@@ -50,8 +55,21 @@ const Technique = () => {
}
return
+
+ {getTranslation(technique, 'title', i18n.language)}
+
+
+
;
};
-export default Technique;
+Technique.propTypes = {
+ type: PropTypes.string,
+};
+
+export default withTranslation()(Technique);