Skip to content

Commit 862fe1a

Browse files
committed
👌 update server.routes.js
1 parent d42f10e commit 862fe1a

File tree

4 files changed

+6
-52
lines changed

4 files changed

+6
-52
lines changed

client/modules/App/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class App extends React.Component {
3535
return (
3636
<div className="app">
3737
{/* FIXME: remove false */}
38-
{this.state.isMounted && !window.devToolsExtension && getConfig('NODE_ENV') === 'development' && <DevTools />}
38+
{false && this.state.isMounted && !window.devToolsExtension && getConfig('NODE_ENV') === 'development' && <DevTools />}
3939
{this.props.children}
4040
</div>
4141
);

client/routes.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const checkAuth = (store) => {
2727
// TODO: This short-circuit seems unnecessary - using the mobile <Switch /> navigator (future) should prevent this from being called
2828
const onRouteChange = (store) => {
2929
const path = window.location.pathname;
30-
if (path.includes('/mobile')) return;
30+
if (path.includes('/mobile/preview')) return;
3131

3232
store.dispatch(stopSketch());
3333
};

server/routes/server.routes.js

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -145,54 +145,4 @@ router.get('/:username/collections', (req, res) => {
145145
});
146146

147147

148-
// Mobile Routes
149-
if (process.env.MOBILE_ENABLED) {
150-
router.get('/mobile', (req, res) => res.send(renderIndex()));
151-
152-
router.get('/mobile/preview', (req, res) => res.send(renderIndex()));
153-
154-
router.get('/mobile/preferences', (req, res) => res.send(renderIndex()));
155-
156-
router.get('/mobile/:username/sketches', (req, res) => {
157-
userExists(req.params.username, fallback404(res));
158-
});
159-
160-
router.get('/mobile/:username/sketches/:project_id', (req, res) => {
161-
projectForUserExists(req.params.username, req.params.project_id, fallback404(res));
162-
});
163-
164-
router.get('/mobile/:username/assets', (req, res) => {
165-
userExists(req.params.username, (exists) => {
166-
const isLoggedInUser = req.user && req.user.username === req.params.username;
167-
const canAccess = exists && isLoggedInUser;
168-
return canAccess ?
169-
res.send(renderIndex()) :
170-
get404Sketch(html => res.send(html));
171-
});
172-
});
173-
174-
router.get('/mobile/:username/collections/create', (req, res) => {
175-
userExists(req.params.username, (exists) => {
176-
const isLoggedInUser = req.user && req.user.username === req.params.username;
177-
const canAccess = exists && isLoggedInUser;
178-
return canAccess ?
179-
res.send(renderIndex()) :
180-
get404Sketch(html => res.send(html));
181-
});
182-
});
183-
184-
185-
router.get('/mobile/:username/collections', (req, res) => {
186-
userExists(req.params.username, fallback404(res));
187-
});
188-
189-
router.get('/mobile/:username/collections/create', (req, res) => {
190-
userExists(req.params.username, fallback404(res));
191-
});
192-
193-
router.get('/mobile/:username/collections/:id', (req, res) => {
194-
collectionForUserExists(req.params.username, req.params.id, fallback404(res));
195-
});
196-
}
197-
198148
export default router;

server/server.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ app.get(
132132
// isomorphic rendering
133133
app.use('/', serverRoutes);
134134

135+
if (process.env.MOBILE_ENABLED) {
136+
app.use('/mobile', serverRoutes);
137+
}
138+
135139
app.use(assetRoutes);
136140

137141
app.use('/', embedRoutes);

0 commit comments

Comments
 (0)