Skip to content

Commit 5c0cb93

Browse files
committed
Fix : Clean some useless code and repair domain in settings
1 parent f85d8fe commit 5c0cb93

File tree

2 files changed

+14
-30
lines changed

2 files changed

+14
-30
lines changed

UI/src/services/apiService.ts

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,25 @@ api.interceptors.response.use(
5454

5555
// Inscription
5656
export const registerUser = async (userData: any) =>
57-
await api.post(`${API_URL}register/`, userData)
57+
await api.post(`register/`, userData)
5858

5959
// Connexion
6060
export const loginUser = async (credentials: {
6161
email: string
6262
password: string
6363
}) => {
64-
const response = await api.post<LoginResponse>(
65-
`${API_URL}login/`,
66-
credentials
67-
)
64+
const response = await api.post<LoginResponse>(`login/`, credentials)
6865
return response.data
6966
}
7067

7168
// Déconnexion
7269
export const logoutUser = async () => {
73-
await api.post(`${API_URL}logout/`)
70+
await api.post(`logout/`)
7471
}
7572

7673
export const checkAuthentication = async () => {
7774
try {
78-
const response = await api.get(`${API_URL}check-authentication/`, {
79-
withCredentials: true,
80-
})
75+
const response = await api.get("check-authentication/")
8176
return response.data.authenticated
8277
} catch {
8378
return false
@@ -86,28 +81,25 @@ export const checkAuthentication = async () => {
8681

8782
// Update du profil
8883
export const updateProfile = async (userData: any) => {
89-
const response = await api.patch(`${API_URL}profile/`, userData, {
90-
withCredentials: true,
91-
})
84+
const response = await api.patch("profile/", userData)
9285
return response.data
9386
}
9487

9588
// Suppression du compte
96-
export const deleteAccount = async () =>
97-
await api.delete(`${API_URL}delete-account/`, { withCredentials: true })
89+
export const deleteAccount = async () => await api.delete("delete-account/")
9890

9991
// Envoi de code de vérification selon un contexte
10092
export const sendVerificationCode = async (
10193
email: string,
10294
context: "registration" | "reset-password"
103-
) => await api.post(`${API_URL}send-code-${context}/`, { email })
95+
) => await api.post(`send-code-${context}/`, { email })
10496

10597
// Verifier le code
10698
export const verifyCode = async (
10799
email: string,
108100
code: string
109101
): Promise<VerifyCodeResponse> => {
110-
const response = await api.post(`${API_URL}verify-code/`, {
102+
const response = await api.post("verify-code/", {
111103
email,
112104
code,
113105
})
@@ -116,7 +108,7 @@ export const verifyCode = async (
116108

117109
// Réinitialiser le mot de passe
118110
export const resetPassword = async (email: string, password: string) => {
119-
const response = await api.post(`${API_URL}reset-password/`, {
111+
const response = await api.post("reset-password/", {
120112
email,
121113
password,
122114
})
@@ -135,9 +127,7 @@ export const calculateCalories = async (payload: {
135127
goal: string | null
136128
}): Promise<CaloriesResponse> => {
137129
try {
138-
const response = await api.post(`${API_URL}calculate-calories/`, payload, {
139-
withCredentials: true,
140-
})
130+
const response = await api.post("calculate-calories/", payload)
141131
return response.data
142132
} catch (error) {
143133
throw error
@@ -149,7 +139,7 @@ export const calculateCalories = async (payload: {
149139
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
150140
export const getProgressRecords = async (): Promise<ProgressRecord[]> => {
151141
try {
152-
const response = await axios.get(`${API_URL}progress-records/`)
142+
const response = await api.get("progress-records/")
153143
return response.data
154144
} catch (error) {
155145
throw error
@@ -161,11 +151,7 @@ export const updateRecord = async (
161151
payload: Record<string, any>
162152
): Promise<ProgressRecord> => {
163153
try {
164-
const response = await axios.patch(
165-
`${API_URL}progress-records/${id}/`,
166-
payload,
167-
{ withCredentials: true }
168-
)
154+
const response = await api.patch(`progress-records/${id}/`, payload)
169155
return response.data
170156
} catch (error) {
171157
throw error
@@ -174,9 +160,7 @@ export const updateRecord = async (
174160

175161
export const deleteRecord = async (id: number) => {
176162
try {
177-
await axios.delete(`${API_URL}progress-records/${id}/`, {
178-
withCredentials: true,
179-
})
163+
await api.delete(`progress-records/${id}/`)
180164
} catch (error) {
181165
throw error
182166
}

WS/next_shape_ws/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def get_cookie_settings():
222222
"httponly": True,
223223
"secure": True,
224224
"samesite": "None",
225-
"domain": ".onrender.com",
225+
"domain": "nextshape.onrender.com",
226226
"path": "/",
227227
}
228228
else:

0 commit comments

Comments
 (0)