]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/pages/Technique.js
relax unique constraint on techniques
[alttp.git] / resources / js / components / pages / Technique.js
index c4be0666614eb932d5c22e5ae8ccbf0ffd3dc23b..4004707895ad23dc18607e1af5a1758c2b01e3fa 100644 (file)
@@ -1,4 +1,5 @@
 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';
@@ -13,7 +14,7 @@ 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;
 
@@ -25,7 +26,7 @@ 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);
@@ -39,7 +40,7 @@ const Technique = () => {
                return () => {
                        ctrl.abort();
                };
-       }, [name]);
+       }, [name, type]);
 
        if (loading) {
                return <Loading />;
@@ -67,4 +68,8 @@ const Technique = () => {
        </ErrorBoundary>;
 };
 
+Technique.propTypes = {
+       type: PropTypes.string,
+};
+
 export default withTranslation()(Technique);