diff --git a/front/src/view/AllToucanPage/AllToucanPage.js b/front/src/view/AllToucanPage/AllToucanPage.js index 9ca13072ca0bb2a2b166c6a0cbf3b4e5cd0d2d0a..6a6244f9ae4e464852ab3e8bc9ee7a9136a08344 100644 --- a/front/src/view/AllToucanPage/AllToucanPage.js +++ b/front/src/view/AllToucanPage/AllToucanPage.js @@ -7,8 +7,12 @@ import ToucanCard from './ToucanCard' const date = new Date() const beginYear = 1900 + (date.getMonth() < 7 ? date.getYear()-1 : date.getYear()); +function formToucanUrlId(toucan){ + return toucan.title.toLowerCase().replace(/\s/g, "")+"-"+toucan.date.getFullYear(); +} + function AllToucan(props){ - const [urltoucans,setToucans] = useState([]); + const [toucans,setToucans] = useState([]); const [before,setBefore] = useState((new Date(beginYear+1,6,31)).getTime()); const [after, setAfter] = useState((new Date(beginYear,7,1)).getTime()); @@ -46,10 +50,10 @@ function AllToucan(props){ updateFrame = {updateFrame} /> <Card.Group centered > - {urltoucans.map( toucan => { + {toucans.map( toucan => { return <ToucanCard image={`${props.backURL}/toucan/img/${toucan["_id"]}`} - link={`${props.backURL}/toucan/pdf/${toucan.urlID}`} + link={`${props.backURL}/toucan/pdf/${formToucanUrlId(toucan)}+`} header={toucan.title} toucanId={toucan._id} isAdmin={props.isAdmin}