diff --git a/frontend/src/components/debug/index.tsx b/frontend/src/components/debug/index.tsx index f38c93bd92ce791f9a38ed4d2eca58a6b8c254b6..1097897ff8bfe539ca1899e9149ca48a07293b2c 100644 --- a/frontend/src/components/debug/index.tsx +++ b/frontend/src/components/debug/index.tsx @@ -30,7 +30,7 @@ export const Debug = () => { if (!didContactApi) { setDidContactApi(true) - fetch('http://localhost:3000/api/health/') + fetch('/api/health/') .then((res) => res.text()) .then((result) => { if (result === 'OK') { diff --git a/frontend/src/hooks/useOus/index.tsx b/frontend/src/hooks/useOus/index.tsx index 99188e7608c5249268ebd6a38855d2ab76ea9bb6..64c12dba296b0065935a9415892ecd6c21f672e7 100644 --- a/frontend/src/hooks/useOus/index.tsx +++ b/frontend/src/hooks/useOus/index.tsx @@ -9,9 +9,7 @@ type OuData = { function useOus(): OuData[] { const [ous, setOus] = useState<OuData[]>([]) const getOptions = async () => { - const response = await fetch( - 'http://localhost:3000/api/ui/v1/ous/?format=json' - ) + const response = await fetch('/api/ui/v1/ous/?format=json') if (response.ok) { const ousJson = await response.json() setOus(ousJson.ous) diff --git a/frontend/src/routes/frontpage/components/loginpage.tsx b/frontend/src/routes/frontpage/components/loginpage.tsx index b94015aef2897ef4108c3c632246303d20558b6b..711648f86f99d57040307733539ddf23382a66be 100644 --- a/frontend/src/routes/frontpage/components/loginpage.tsx +++ b/frontend/src/routes/frontpage/components/loginpage.tsx @@ -20,7 +20,7 @@ export default function LoginPage() { <Container maxWidth="sm"> <h2>{t('header')}</h2> <StyledParagraph>{t('description')}</StyledParagraph> - <HrefButton to="/api/oidc/authenticate">{t('login')}</HrefButton> + <HrefButton to="/oidc/authenticate/">{t('login')}</HrefButton> </Container> </StyledWrapper> ) diff --git a/frontend/src/routes/index.tsx b/frontend/src/routes/index.tsx index b0796e24548d6f14607d8bd93644e63cd5f2e738..4504a47c82c6535cc1617c474ad40cc74bab1484 100644 --- a/frontend/src/routes/index.tsx +++ b/frontend/src/routes/index.tsx @@ -50,7 +50,7 @@ export default function App() { <ProtectedRoute path='/sponsor'> <Sponsor /> </ProtectedRoute> - <Route path='register'> + <Route path='/register'> <Register /> </Route> <Route> diff --git a/frontend/src/routes/register/stepSummary.tsx b/frontend/src/routes/register/stepSummary.tsx index 2d24c768b6289726ae634d4d794c58537c387e50..b855da2825aaaf1e5d5def4a9cd8166d88e71678 100644 --- a/frontend/src/routes/register/stepSummary.tsx +++ b/frontend/src/routes/register/stepSummary.tsx @@ -35,7 +35,7 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor email: data.email, } console.log('submitting', JSON.stringify(payload)) - fetch('http://localhost:3000/api/ui/v1/register/', postJsonOpts(payload)) + fetch('/api/ui/v1/register/', postJsonOpts(payload)) .then((res) => res.text()) .then((result) => { console.log('result', result) diff --git a/frontend/src/routes/sponsor/frontpage/index.tsx b/frontend/src/routes/sponsor/frontpage/index.tsx index e1fa859ecd3af065eb3d533a0de06f59055dc244..bb48c68717f027026f98f5e5a6e324dc6a273cf7 100644 --- a/frontend/src/routes/sponsor/frontpage/index.tsx +++ b/frontend/src/routes/sponsor/frontpage/index.tsx @@ -151,9 +151,7 @@ function FrontPage() { const [t] = useTranslation(['common']) const fetchGuestsInfo = async () => { - const response = await fetch( - 'http://localhost:3000/api/ui/v1/persons/?format=json' - ) + const response = await fetch('/api/ui/v1/persons/?format=json') const jsonResponse = await response.json() if (response.ok) { const roles = await jsonResponse.roles diff --git a/frontend/src/setupProxy.js b/frontend/src/setupProxy.js index a7d60f51a8c878a73e44ebf9849b965a65b330db..1edb7f684ea4fd231f86e10916ccda951e8302d3 100644 --- a/frontend/src/setupProxy.js +++ b/frontend/src/setupProxy.js @@ -2,7 +2,13 @@ const { createProxyMiddleware } = require('http-proxy-middleware') module.exports = (app) => { app.use( - '/api', + [ + '/admin*', // Django admin + '/staticfiles*', // Django static files + '/api*', // API + '/schema*', // API schema + '/oidc*', // OpenID connect login endpoint + ], createProxyMiddleware({ target: 'http://localhost:8000', changeOrigin: true, diff --git a/gregsite/urls.py b/gregsite/urls.py index be0f570ba76bdaa4d6263763caab7dd77684a37f..07e64cd7a2e9383a96674c25c6b4a82be58bba25 100644 --- a/gregsite/urls.py +++ b/gregsite/urls.py @@ -22,8 +22,8 @@ from gregui import urls as ui_urls admin.autodiscover() urlpatterns = [ - path("api/admin/", admin.site.urls), + path("admin/", admin.site.urls), path("", include(greg_urls.urlpatterns)), path("", include(ui_urls.urlpatterns)), - path("api/oidc/", include("mozilla_django_oidc.urls")), + path("oidc/", include("mozilla_django_oidc.urls")), ]