Skip to content
Snippets Groups Projects
Commit 09a627c6 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Merge branch 'test-no-baseurl' of...

Merge branch 'test-no-baseurl' of https://forge.grandlyon.com/web-et-numerique/llle_project/backoffice-client into local-conf
parents 2aa887fb ecd88441
No related branches found
No related tags found
2 merge requests!8local- conf,!7feat: add front office
......@@ -23,4 +23,7 @@ server {
location /Logout {
proxy_pass https://backend:1443/Logout;
}
location /swagger {
proxy_pass https://backend:1443/swagger;
}
}
<!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" />
......
......@@ -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 />
......
......@@ -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')
......
......@@ -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)
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment