Skip to content

Commit d3eab07

Browse files
committed
switched api calls to azure
1 parent 6cc1a69 commit d3eab07

File tree

10 files changed

+25
-44
lines changed

10 files changed

+25
-44
lines changed

packages/react-frontend/src/Components/Table.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function TableBody(props) {
3131
<button onClick={() => props.removeProduct(index)}>Delete</button>
3232
</td>
3333
<td>
34-
<a href={`http://localhost:5173/product/${row._id}`}>
34+
<a href={`safehaven307.azurewebsites.net/product/${row._id}`}>
3535
<button>Edit</button>
3636
</a>
3737
</td>

packages/react-frontend/src/Views/AddOrders.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ function AddOrders() {
7676
}
7777

7878
function fetchOrders() {
79-
return fetch("http://localhost:8000/order-units", {
79+
return fetch("safehaven307.azurewebsites.net/order-units", {
8080
headers: addAuthHeader()
8181
});
8282
}
8383

8484
function postOrderUnit(order) {
85-
return fetch("http://localhost:8000/order-units", {
85+
return fetch("safehaven307.azurewebsites.net/order-units", {
8686
method: "POST",
8787
headers: addAuthHeader({
8888
"Content-Type": "application/json"
@@ -92,7 +92,7 @@ function AddOrders() {
9292
}
9393

9494
function deleteOrder(id) {
95-
const uri = `http://localhost:8000/order-units/${id}`;
95+
const uri = `safehaven307.azurewebsites.net/order-units/${id}`;
9696
return fetch(uri, {
9797
method: "DELETE",
9898
headers: addAuthHeader({
@@ -102,7 +102,7 @@ function AddOrders() {
102102
}
103103

104104
function runPost(order_str) {
105-
return fetch("http://localhost:8000/orders", {
105+
return fetch("safehaven307.azurewebsites.net/orders", {
106106
method: "POST",
107107
headers: addAuthHeader({
108108
"Content-Type": "application/json"

packages/react-frontend/src/Views/EditProfile.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useNavigate } from "react-router-dom";
88
function EditProfile() {
99
const navigate = useNavigate();
1010
function changeProfile(profile){
11-
fetch("http://localhost:8000/users/profile", {
11+
fetch("safehaven307.azurewebsites.net/users/profile", {
1212
method: "POST",
1313
headers: addAuthHeader({
1414
"Content-Type": "application/json"

packages/react-frontend/src/Views/Inventory.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ function Inventory() {
7171
}
7272

7373
function fetchProducts() {
74-
const promise = fetch("http://localhost:8000/products", {
74+
const promise = fetch("safehaven307.azurewebsites.net/products", {
7575
headers: addAuthHeader()
7676
});
7777
return promise;
7878
}
7979

8080
function postProduct(product) {
8181
console.log("posting:", product);
82-
return fetch("http://localhost:8000/products", {
82+
return fetch("safehaven307.azurewebsites.net/products", {
8383
method: "POST",
8484
headers: addAuthHeader({
8585
"Content-Type": "application/json"
@@ -89,7 +89,7 @@ function Inventory() {
8989
}
9090

9191
function deleteProduct(id) {
92-
const uri = `http://localhost:8000/products/${id}`;
92+
const uri = `safehaven307.azurewebsites.net/products/${id}`;
9393
return fetch(uri, {
9494
method: "DELETE",
9595
headers: addAuthHeader({

packages/react-frontend/src/Views/LoginPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function Login() {
99
const navigate = useNavigate();
1010
function authenticateUser(user) {
1111
console.log(user);
12-
fetch("http://localhost:8000/login", {
12+
fetch("safehaven307.azurewebsites.net/login", {
1313
method: "POST",
1414
headers: {
1515
"Content-Type": "application/json"

packages/react-frontend/src/Views/ManageOrders.jsx

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ function ManageOrders() {
4242
};
4343

4444
function fetchOrders() {
45-
return fetch("http://localhost:8000/orders", {
45+
return fetch("safehaven307.azurewebsites.net/orders", {
4646
headers: addAuthHeader()
4747
});
4848
}
4949

5050
function fetchSearch(search) {
5151
search = "search=" + search;
52-
const uri = `http://localhost:8000/orders/?${search}`;
52+
const uri = `safehaven307.azurewebsites.net/orders/?${search}`;
5353
console.log(uri);
5454
return fetch(uri, {
5555
headers: addAuthHeader()
5656
});
5757
}
5858

5959
function deleteOrder(id) {
60-
const uri = `http://localhost:8000/orders/${id}`;
60+
const uri = `safehaven307.azurewebsites.net/orders/${id}`;
6161
return fetch(uri, {
6262
method: "DELETE",
6363
headers: addAuthHeader({
@@ -67,25 +67,6 @@ function ManageOrders() {
6767
}
6868

6969
function searchOrder(str) {
70-
/*let temp_orders = orders;
71-
let match_items = [];
72-
temp_orders = temp_orders.filter((o) =>
73-
{
74-
let items = o["items"];
75-
console.log(items);
76-
items = items.filter((i) =>
77-
{
78-
console.log(i);
79-
console.log(i["product"].includes(str));
80-
return(i["product"].includes(str));
81-
});
82-
console.log(items);
83-
console.log(o);
84-
if (items.length != 0){
85-
return true;
86-
}
87-
});
88-
console.log(temp_orders);*/
8970

9071
console.log(str);
9172
fetchSearch(str)

packages/react-frontend/src/Views/OrderStatistics.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ function Inventory() {
6464
}
6565

6666
function fetchProducts() {
67-
return fetch("http://localhost:8000/products", {
67+
return fetch("safehaven307.azurewebsites.net/products", {
6868
headers: addAuthHeader()
6969
});
7070
}
7171

7272
function postProduct(product) {
73-
return fetch("http://localhost:8000/products", {
73+
return fetch("safehaven307.azurewebsites.net/products", {
7474
method: "POST",
7575
headers: addAuthHeader({
7676
"Content-Type": "application/json"
@@ -80,7 +80,7 @@ function Inventory() {
8080
}
8181

8282
function deleteProduct(id) {
83-
const uri = `http://localhost:8000/products/${id}`;
83+
const uri = `safehaven307.azurewebsites.net/products/${id}`;
8484
return fetch(uri, {
8585
method: "DELETE",
8686
headers: addAuthHeader({

packages/react-frontend/src/Views/ProductPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function ProductPage() {
3333

3434
function fetchProduct(id) {
3535
console.log(`Fetching product with id: ${id}`);
36-
return fetch(`http://localhost:8000/products/${id}`, {
36+
return fetch(`safehaven307.azurewebsites.net/products/${id}`, {
3737
headers: addAuthHeader()
3838
})
3939
.then((res) => {
@@ -76,7 +76,7 @@ function ProductPage() {
7676

7777
function patchProduct(product) {
7878
console.log("patching: ", product);
79-
return fetch(`http://localhost:8000/products/${id}`, {
79+
return fetch(`safehaven307.azurewebsites.net/products/${id}`, {
8080
method: "PATCH",
8181
headers: addAuthHeader({
8282
"Content-Type": "application/json"

packages/react-frontend/src/Views/Profile.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ function Profile() {
1313

1414
useEffect(() => {
1515
async function getUser() {
16-
const user_details = await axios.get(`http://localhost:8000/users`, {
16+
const user_details = await axios.get(`safehaven307.azurewebsites.net/users`, {
1717
headers: addAuthHeader()
1818
});
1919
const user = user_details.data;
2020
setUser(user);
2121

22-
const imageUrl = `http://localhost:8000/profile-picture/${user.profilePicture}`;
22+
const imageUrl = `safehaven307.azurewebsites.net/profile-picture/${user.profilePicture}`;
2323

2424
setProfilePicture(imageUrl);
2525
}
2626
async function fetchProfilePicture() {
2727
try {
28-
const imageUrl = `http://localhost:8000/profile-picture/${user.profilePicture}`;
28+
const imageUrl = `safehaven307.azurewebsites.net/profile-picture/${user.profilePicture}`;
2929
setProfilePicture(imageUrl);
3030
} catch (error) {
3131
console.error("Failed to load user profile picture", error);
@@ -49,14 +49,14 @@ function Profile() {
4949

5050
try {
5151
// Send the file to the server for processing and storage in MongoDB
52-
const response = await axios.post("http://localhost:8000/profile-picture", formData, {
52+
const response = await axios.post("safehaven307.azurewebsites.net/profile-picture", formData, {
5353
headers: addAuthHeader({
5454
"Content-Type": "multipart/form-data"
5555
})
5656
});
5757

5858
console.log(response);
59-
const imageUrl = `http://localhost:8000/profile-picture/${response.data}`;
59+
const imageUrl = `safehaven307.azurewebsites.net/profile-picture/${response.data}`;
6060

6161
setProfilePicture(imageUrl);
6262

@@ -68,7 +68,7 @@ function Profile() {
6868
};
6969

7070
function deleteProfile() {
71-
fetch("http://localhost:8000/users", {
71+
fetch("safehaven307.azurewebsites.net/users", {
7272
method: "DELETE",
7373
headers: addAuthHeader({
7474
"Content-Type": "application/json"

packages/react-frontend/src/Views/SignUpPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function Signup() {
88
const navigate = useNavigate();
99
function createUser(user) {
1010
console.log(user);
11-
fetch("http://localhost:8000/users", {
11+
fetch("safehaven307.azurewebsites.net/users", {
1212
method: "POST",
1313
headers: {
1414
"Content-Type": "application/json"

0 commit comments

Comments
 (0)