0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 01:02:47 +00:00

Initial pass at redirecting / to a landing page

This commit is contained in:
G.Ambatte
2022-04-02 10:10:40 +13:00
parent 613b9c4405
commit 468ccd748d
2 changed files with 20 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ const Homebrew = createClass({
<Route path='/user/:username' component={(routeProps)=><UserPage username={routeProps.match.params.username} brews={this.props.brews} query={queryString.parse(routeProps.location.search)}/>}/>
<Route path='/print/:id' component={(routeProps)=><PrintPage brew={this.props.brew} query={queryString.parse(routeProps.location.search)} />}/>
<Route path='/print' exact component={(routeProps)=><PrintPage query={queryString.parse(routeProps.location.search)} />}/>
<Route path='/home' component={()=><SharePage brew={this.props.brew} />}/>
<Route path='/changelog' exact component={()=><SharePage brew={this.props.brew} />}/>
<Route path='/faq' exact component={()=><SharePage brew={this.props.brew} />}/>
<Route path='/v3_preview' exact component={()=><HomePage brew={this.props.brew} />}/>

View File

@@ -109,9 +109,28 @@ app.get('/robots.txt', (req, res)=>{
//Home page
app.get('/', async (req, res, next)=>{
const homePageId = config.get('homePage');
if(homePageId){
return res.redirect('/home');
}
// const brew = homePageId ? await getBrewFromId(homePageId, 'share') : { text: welcomeText } ;
const brew = {
text : welcomeText
};
req.brew = brew;
return next();
});
app.get('/home', async (req, res, next)=>{
const homePageId = config.get('homePage');
const brew = homePageId ? await getBrewFromId(homePageId, 'share') : { text: welcomeText } ;
// const brew = {
// text : welcomeText
// };
req.brew = brew;
return next();
});