base url for api
This commit is contained in:
@@ -1,21 +1,13 @@
|
|||||||
export const registerUser = async (data:any) => {
|
import { API_BASE_URL } from "../config";
|
||||||
const response = await fetch(
|
|
||||||
"https://parsshop-back.mugit.ir/api/auth/register/password",
|
export async function registerUser(data: any) {
|
||||||
{
|
const res = await fetch(`${API_BASE_URL}/auth/register/password`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
}
|
});
|
||||||
);
|
console.log( API_BASE_URL);
|
||||||
|
return res.json();
|
||||||
const result = await response.json();
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|||||||
1
public/src/services/config.tsx
Normal file
1
public/src/services/config.tsx
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export const API_BASE_URL = "https://parsshop-back.mugit.ir/api";
|
||||||
Reference in New Issue
Block a user