Cat: use match params where possible

This commit is contained in:
Tom Russell 2019-05-10 14:00:20 +01:00
parent 60371afd03
commit 0685cbf136
3 changed files with 4 additions and 6 deletions

View File

@ -7,7 +7,6 @@ import InfoBox from './info-box';
import Sidebar from './sidebar';
import Tooltip from './tooltip';
import { SaveIcon } from './icons';
import { parseCategoryURL } from '../parse';
import CONFIG from './fields-config.json';
@ -15,7 +14,7 @@ const BuildingEdit = (props) => {
if (!props.user){
return <Redirect to="/sign-up.html" />
}
const cat = parseCategoryURL(props.match.url);
const cat = props.match.params.cat;
if (!props.building_id){
return (
<Sidebar title="Building Not Found" back={`/edit/${cat}.html`}>

View File

@ -7,7 +7,6 @@ import Sidebar from './sidebar';
import Tooltip from './tooltip';
import InfoBox from './info-box';
import { EditIcon } from './icons';
import { parseCategoryURL } from '../parse';
import CONFIG from './fields-config.json';
@ -22,7 +21,7 @@ const BuildingView = (props) => {
</Sidebar>
);
}
const cat = parseCategoryURL(props.match.url);
const cat = props.match.params.cat;
return (
<Sidebar title={'Data available for this building'} back={`/view/${cat}.html`}>
{

View File

@ -2,14 +2,14 @@ import React from 'react';
import { Redirect } from 'react-router-dom';
import Sidebar from './sidebar';
import { parseCategoryURL } from '../parse';
const MultiEdit = (props) => {
if (!props.user){
return <Redirect to="/sign-up.html" />
}
const cat = parseCategoryURL(props.match.url);
const cat = props.match.params.cat;
return (
<Sidebar
title={`Quick edit`}