Skip to content

Commit 5f794c6

Browse files
authored
Merge pull request #272 from NIAEFEUP/chore/remove-tts-prefix-in-production
chore: remove tts prefix in production
2 parents 99d3db5 + a2f9f4a commit 5f794c6

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/App.tsx

+12-10
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@ import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
33
import './app.css'
44
import CombinedProvider from './contexts/CombinedProvider'
55
import { AboutPage, TimeTableSchedulerPage, FaqsPage, NotFoundPage } from './pages'
6-
import { getPath, config, plausible } from './utils'
6+
import { getPath, config, dev_config, plausible } from './utils'
77
import Layout from './components/layout'
88

9+
const configToUse = Number(import.meta.env.VITE_APP_PROD) ? config : dev_config
10+
911
// Configures the path for pages.
1012
const pages = [
11-
{ path: getPath(config.paths.about), location: 'Sobre', element: AboutPage, liquid: true },
12-
{ path: getPath(config.paths.planner), location: 'Horários', element: TimeTableSchedulerPage, liquid: true },
13-
{ path: getPath(config.paths.faqs), location: 'FAQs', element: FaqsPage, liquid: true },
14-
{ path: getPath(config.paths.notfound), location: 'NotFound', element: NotFoundPage, liquid: true },
13+
{ path: getPath(configToUse.paths.about), location: 'Sobre', element: AboutPage, liquid: true },
14+
{ path: getPath(configToUse.paths.planner), location: 'Horários', element: TimeTableSchedulerPage, liquid: true },
15+
{ path: getPath(configToUse.paths.faqs), location: 'FAQs', element: FaqsPage, liquid: true },
16+
{ path: getPath(configToUse.paths.notfound), location: 'NotFound', element: NotFoundPage, liquid: true },
1517
]
1618

1719
const redirects = [
18-
{ from: "/", to: getPath(config.paths.planner) },
19-
{ from: config.pathPrefix, to: getPath(config.paths.planner) },
20-
{ from: config.pathPrefix.slice(0, -1), to: getPath(config.paths.planner) },
21-
{ from: getPath(config.paths.home), to: getPath(config.paths.about) },
20+
{ from: "/", to: getPath(configToUse.paths.planner) },
21+
{ from: configToUse.pathPrefix, to: getPath(configToUse.paths.planner) },
22+
{ from: configToUse.pathPrefix.slice(0, -1), to: getPath(configToUse.paths.planner) },
23+
{ from: getPath(configToUse.paths.home), to: getPath(configToUse.paths.about) },
2224
]
2325

2426
const App = () => {
@@ -59,4 +61,4 @@ const App = () => {
5961
)
6062
}
6163

62-
export default App
64+
export default App

src/config/local.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"pathPrefix": "/tts/",
2+
"pathPrefix": "/",
33
"paths": {
44
"about": "about",
55
"profile": "profile",

src/config/prod.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"pathPrefix": "/tts/",
2+
"pathPrefix": "/",
33
"paths": {
44
"about": "about",
55
"profile": "profile",

0 commit comments

Comments
 (0)