Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change url from :id to :slug (custom uid field) #40

Closed
YannickMol opened this issue May 25, 2020 · 1 comment
Closed

Change url from :id to :slug (custom uid field) #40

YannickMol opened this issue May 25, 2020 · 1 comment

Comments

@YannickMol
Copy link

YannickMol commented May 25, 2020

Hi there,

I was wondering if anyone would be able to help out with changing the :id in the url of the frontend for the restaurants to a custom field that is also unique (let's say slug). This in order to prettify the urls.

Suggested change in the containers/App/index.js file from:
<Route path="/:id/:content" component={RestaurantPage} exact />
to
<Route path="/:slug/:content" component={RestaurantPage} exact />

Any help here would be appreciated!

Regards,
Yannick

@arunim2405
Copy link

This may be a very long path what you can do is send a post request instead of a get request everytime the category is requested and return the response to the react api context, the items content should then automatically update when it gets new props, essentially turning your application to a SPA (Single page application), although this is a very long approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants