diff --git a/docker-compose.yml b/docker-compose.yml index 9c6be0459f98bd34b941f05bae45a68b57a1286f..758d10b98f6c3712db0c7f386c54141f1979857d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: nginx: - image: registry.forge.grandlyon.com/web-et-numerique/llle_project/backoffice-client:latest + image: registry.forge.grandlyon.com/web-et-numerique/llle_project/backoffice-client:dev restart: unless-stopped ports: - 443:443 @@ -29,7 +29,7 @@ services: retries: 60 backend: - image: registry.forge.grandlyon.com/web-et-numerique/llle_project/backoffice-server:latest + image: registry.forge.grandlyon.com/web-et-numerique/llle_project/backoffice-server:dev networks: backoffice: depends_on: diff --git a/nginx/site.conf b/nginx/site.conf index e6d27c771cb85e336cc864e81228305a257148c7..a15e8627808280c39275a5483e03fb9cf57420d5 100644 --- a/nginx/site.conf +++ b/nginx/site.conf @@ -23,4 +23,7 @@ server { location /Logout { proxy_pass https://backend:1443/Logout; } + location /swagger { + proxy_pass https://backend:1443/swagger; + } } diff --git a/public/index.html b/public/index.html index 155760c816c393333c07e247e646ba9604043c3a..f7cd167053b03ced42bf2abb6ee99c15e304f5cc 100644 --- a/public/index.html +++ b/public/index.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <html lang="en"> <head> - <base href="%PUBLIC_URL%/"> <meta charset="utf-8" /> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> diff --git a/src/App.tsx b/src/App.tsx index ba353aff2a38fe7f4717b594201e8b5d11ca0b88..2495ec0a34b50573029838c2607328603cec7508 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,7 +10,7 @@ function App() { const { user, setUser, isLoading } = useFindUser() return ( - <BrowserRouter basename={process.env.PUBLIC_URL}> + <BrowserRouter> <UserContext.Provider value={{ user, setUser, isLoading }}> <Layout> <Routes /> diff --git a/src/hooks/useAuth.ts b/src/hooks/useAuth.ts index 4bc30ac1d1df96056a8f0ab99a156e13d779a584..656444a218da031dccbec675dcca9c5a25345c78 100644 --- a/src/hooks/useAuth.ts +++ b/src/hooks/useAuth.ts @@ -16,9 +16,7 @@ export const useAuth = (): Auth => { //login user const loginUser = async (): Promise<void> => { try { - await axios.get(`${process.env.PUBLIC_URL}OAuth2Login`, { - withCredentials: true, - }) + window.location.href="/OAuth2Login" await setUserContext() } catch (e) { setError(e) @@ -28,7 +26,7 @@ export const useAuth = (): Auth => { const logoutUser = async (): Promise<void> => { try { if (setUser) setUser(null) - await axios.get(`${process.env.PUBLIC_URL}Logout`) + window.location.href="/Logout" } catch (e) { setError(e) } @@ -37,12 +35,7 @@ export const useAuth = (): Auth => { //set user in context and push them home const setUserContext = async (): Promise<void> => { try { - const { data } = await axios.get( - `${process.env.PUBLIC_URL}api/common/WhoAmI`, - { - withCredentials: true, - } - ) + const { data } = await axios.get(`/api/common/WhoAmI`) if (data && setUser) { setUser(data) history.push('/editing') diff --git a/src/hooks/useFindUser.ts b/src/hooks/useFindUser.ts index 8e1f51c8a3ff385ae5fb1aaa384233a386567fd0..3c853bca6acc2f327dc1c1fc2dd94210a3042bb0 100644 --- a/src/hooks/useFindUser.ts +++ b/src/hooks/useFindUser.ts @@ -8,9 +8,7 @@ const useFindUser = () => { useEffect(() => { async function findUser() { - const { data } = await axios.get( - `${process.env.PUBLIC_URL}api/common/WhoAmI` - ) + const { data } = await axios.get(`/api/common/WhoAmI`) if (data) { setUser(data) setLoading(false) diff --git a/src/services/monthlyNews.service.ts b/src/services/monthlyNews.service.ts index 417519ace092fe291c040ccf537cdfa8817574ea..dc1f95719e45787fe639cd5cd4539ece7e71a53d 100644 --- a/src/services/monthlyNews.service.ts +++ b/src/services/monthlyNews.service.ts @@ -3,10 +3,7 @@ import { IMonthlyNews } from '../models/monthlyNews.model' import { IPoll } from '../models/poll.model' import { toast } from 'react-toastify' export class MonthlyNewsService { - private readonly _apiUrl: string - constructor() { - this._apiUrl = 'https://localhost:443/' - } + /** * Creates a quotation and header for selected month * @param date @@ -21,7 +18,7 @@ export class MonthlyNewsService { ): Promise<void> => { try { await axios.put( - `${process.env.PUBLIC_URL}/api/admin/monthlyNews`, + `/api/admin/monthlyNews`, { month: date.getMonth(), year: date.getFullYear(), @@ -51,7 +48,7 @@ export class MonthlyNewsService { ): Promise<IMonthlyNews | null> => { try { const { data } = await axios.get( - `${process.env.PUBLIC_URL}/api/admin/monthlyNews/${year}/${month}`, + `/api/admin/monthlyNews/${year}/${month}`, { headers: { 'XSRF-TOKEN': token, @@ -75,7 +72,7 @@ export class MonthlyNewsService { ): Promise<IPoll | null> => { try { const { data } = await axios.get( - `${process.env.PUBLIC_URL}/api/admin/poll/${year}/${month}`, + `/api/admin/poll/${year}/${month}`, { headers: { 'XSRF-TOKEN': token, @@ -103,7 +100,7 @@ export class MonthlyNewsService { ): Promise<void> => { try { await axios.put( - `${process.env.PUBLIC_URL}/api/admin/poll`, + `/api/admin/poll`, { month: date.getMonth(), year: date.getFullYear(), @@ -135,7 +132,7 @@ export class MonthlyNewsService { ): Promise<void> => { try { await axios.delete( - `${process.env.PUBLIC_URL}api/admin/poll/${year}/${month}`, + `/api/admin/poll/${year}/${month}`, { headers: { 'XSRF-TOKEN': token, @@ -161,7 +158,7 @@ export class MonthlyNewsService { ): Promise<void> => { try { await axios.delete( - `${process.env.PUBLIC_URL}api/admin/monthlyNews/${year}/${month}`, + `/api/admin/monthlyNews/${year}/${month}`, { headers: { 'XSRF-TOKEN': token,