diff --git a/static/src/js/components/navbar/item.js b/static/src/js/components/navbar/item.js index 059066e..03e2984 100644 --- a/static/src/js/components/navbar/item.js +++ b/static/src/js/components/navbar/item.js @@ -1,29 +1,9 @@ import React from 'react'; -import Reverser from '../../helpers/reverser'; export default class Item extends React.Component { - constructor() { - super(); - this.state = { - url: '#' - }; - } - - componentDidMount() { - if (!this.props.href && !this.props.ident) { - return; - } - - if (this.props.href) { - this.setState({url: this.props.href}); - } else { - Reverser(this.props.ident, this.props.args, function (url) { - this.setState({ url }); - }.bind(this)); - } - } render() { + const href = this.props.href.endsWith('/') ? this.props.href : this.props.href + '/'; let icon; if (this.props.icon) { if (this.props.icon.startsWith('ion')) { @@ -37,7 +17,7 @@ export default class Item extends React.Component { } } return ( -
  • {icon}{this.props.children}
  • +
  • {icon}{this.props.children}
  • ); } } diff --git a/static/src/js/components/navbar/navbar.js b/static/src/js/components/navbar/navbar.js index dfa19bd..30af956 100644 --- a/static/src/js/components/navbar/navbar.js +++ b/static/src/js/components/navbar/navbar.js @@ -18,14 +18,15 @@ export default class NavBar extends React.Component { diff --git a/static/src/js/helpers/reverser.js b/static/src/js/helpers/reverser.js deleted file mode 100644 index 9baf18f..0000000 --- a/static/src/js/helpers/reverser.js +++ /dev/null @@ -1,33 +0,0 @@ -export default function Reverser(ident, args, onSuccess) { - let body = {}; - if (ident) { - body.ident = ident; - if (args) { - body.args = args; - } - } - if (body !== {}) { - body = JSON.stringify(body); - fetch('/reverse/', { - method: 'post', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - body - }).then(function (response) { - if (response.status === 302) { - return response; - } else { - var error = new Error(response.statusText); - error.response = response; - throw error; - } - }).then( - (response) => response.json() - ).then(onSuccess) - .catch(function (err) { - console.log(err); - }); - } -}