Skip to content

Commit

Permalink
Make deploy work
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 committed Jun 6, 2024
1 parent 5ad94fa commit 134d705
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
submodules: true
lfs: false
- run: npm ci
- run: npm build
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
Expand All @@ -31,7 +32,7 @@ jobs:
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "./packages/react-frontend" # App source code path
api_location: "" # Api source code path - optional
output_location: "build" # Built app content directory - optional
output_location: "dist" # Built app content directory - optional
###### End of Repository/Build Configurations ######

close_pull_request_job:
Expand Down
2 changes: 1 addition & 1 deletion packages/express-backend/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ app.post(

const pfp = { profilePicture: result._id };

fetch(`safehaven307.azurewebsites.net/users/${user._id}`, {
fetch(`https://safehaven2.azurewebsites.net/users/${user._id}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-frontend/src/Components/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function TableBody(props) {
<button onClick={() => props.removeProduct(index)}>Delete</button>
</td>
<td>
<a href={`safehaven307.azurewebsites.net/product/${row._id}`}>
<a href={`https://safehaven2.azurewebsites.net/product/${row._id}`}>
<button>Edit</button>
</a>
</td>
Expand Down
8 changes: 4 additions & 4 deletions packages/react-frontend/src/Views/AddOrders.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ function AddOrders() {
}

function fetchOrders() {
return fetch("safehaven307.azurewebsites.net/order-units", {
return fetch("https://safehaven2.azurewebsites.net/order-units", {
headers: addAuthHeader()
});
}

function postOrderUnit(order) {
return fetch("safehaven307.azurewebsites.net/order-units", {
return fetch("https://safehaven2.azurewebsites.net/order-units", {
method: "POST",
headers: addAuthHeader({
"Content-Type": "application/json"
Expand All @@ -92,7 +92,7 @@ function AddOrders() {
}

function deleteOrder(id) {
const uri = `safehaven307.azurewebsites.net/order-units/${id}`;
const uri = `https://safehaven2.azurewebsites.net/order-units/${id}`;
return fetch(uri, {
method: "DELETE",
headers: addAuthHeader({
Expand All @@ -102,7 +102,7 @@ function AddOrders() {
}

function runPost(order_str) {
return fetch("safehaven307.azurewebsites.net/orders", {
return fetch("https://safehaven2.azurewebsites.net/orders", {
method: "POST",
headers: addAuthHeader({
"Content-Type": "application/json"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-frontend/src/Views/EditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useNavigate } from "react-router-dom";
function EditProfile() {
const navigate = useNavigate();
function changeProfile(profile){
fetch("safehaven307.azurewebsites.net/users/profile", {
fetch("https://safehaven2.azurewebsites.net/users/profile", {
method: "POST",
headers: addAuthHeader({
"Content-Type": "application/json"
Expand Down
6 changes: 3 additions & 3 deletions packages/react-frontend/src/Views/Inventory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ function Inventory() {
}

function fetchProducts() {
const promise = fetch("safehaven307.azurewebsites.net/products", {
const promise = fetch("https://safehaven2.azurewebsites.net/products", {
headers: addAuthHeader()
});
return promise;
}

function postProduct(product) {
console.log("posting:", product);
return fetch("safehaven307.azurewebsites.net/products", {
return fetch("https://safehaven2.azurewebsites.net/products", {
method: "POST",
headers: addAuthHeader({
"Content-Type": "application/json"
Expand All @@ -89,7 +89,7 @@ function Inventory() {
}

function deleteProduct(id) {
const uri = `safehaven307.azurewebsites.net/products/${id}`;
const uri = `https://safehaven2.azurewebsites.net/products/${id}`;
return fetch(uri, {
method: "DELETE",
headers: addAuthHeader({
Expand Down
2 changes: 1 addition & 1 deletion packages/react-frontend/src/Views/LoginPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Login() {
const navigate = useNavigate();
function authenticateUser(user) {
console.log(user);
fetch("safehaven307.azurewebsites.net/login", {
fetch("https://safehaven2.azurewebsites.net/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
Expand Down
6 changes: 3 additions & 3 deletions packages/react-frontend/src/Views/ManageOrders.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ function ManageOrders() {
};

function fetchOrders() {
return fetch("safehaven307.azurewebsites.net/orders", {
return fetch("https://safehaven2.azurewebsites.net/orders", {
headers: addAuthHeader()
});
}

function fetchSearch(search) {
search = "search=" + search;
const uri = `safehaven307.azurewebsites.net/orders/?${search}`;
const uri = `https://safehaven2.azurewebsites.net/orders/?${search}`;
console.log(uri);
return fetch(uri, {
headers: addAuthHeader()
});
}

function deleteOrder(id) {
const uri = `safehaven307.azurewebsites.net/orders/${id}`;
const uri = `https://safehaven2.azurewebsites.net/orders/${id}`;
return fetch(uri, {
method: "DELETE",
headers: addAuthHeader({
Expand Down
6 changes: 3 additions & 3 deletions packages/react-frontend/src/Views/OrderStatistics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ function Inventory() {
}

function fetchProducts() {
return fetch("safehaven307.azurewebsites.net/products", {
return fetch("https://safehaven2.azurewebsites.net/products", {
headers: addAuthHeader()
});
}

function postProduct(product) {
return fetch("safehaven307.azurewebsites.net/products", {
return fetch("https://safehaven2.azurewebsites.net/products", {
method: "POST",
headers: addAuthHeader({
"Content-Type": "application/json"
Expand All @@ -80,7 +80,7 @@ function Inventory() {
}

function deleteProduct(id) {
const uri = `safehaven307.azurewebsites.net/products/${id}`;
const uri = `https://safehaven2.azurewebsites.net/products/${id}`;
return fetch(uri, {
method: "DELETE",
headers: addAuthHeader({
Expand Down
4 changes: 2 additions & 2 deletions packages/react-frontend/src/Views/ProductPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function ProductPage() {

function fetchProduct(id) {
console.log(`Fetching product with id: ${id}`);
return fetch(`safehaven307.azurewebsites.net/products/${id}`, {
return fetch(`https://safehaven2.azurewebsites.net/products/${id}`, {
headers: addAuthHeader()
})
.then((res) => {
Expand Down Expand Up @@ -76,7 +76,7 @@ function ProductPage() {

function patchProduct(product) {
console.log("patching: ", product);
return fetch(`safehaven307.azurewebsites.net/products/${id}`, {
return fetch(`https://safehaven2.azurewebsites.net/products/${id}`, {
method: "PATCH",
headers: addAuthHeader({
"Content-Type": "application/json"
Expand Down
12 changes: 6 additions & 6 deletions packages/react-frontend/src/Views/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ function Profile() {

useEffect(() => {
async function getUser() {
const user_details = await axios.get(`safehaven307.azurewebsites.net/users`, {
const user_details = await axios.get(`https://safehaven2.azurewebsites.net/users`, {
headers: addAuthHeader()
});
const user = user_details.data;
setUser(user);

const imageUrl = `safehaven307.azurewebsites.net/profile-picture/${user.profilePicture}`;
const imageUrl = `https://safehaven2.azurewebsites.net/profile-picture/${user.profilePicture}`;

setProfilePicture(imageUrl);
}
async function fetchProfilePicture() {
try {
const imageUrl = `safehaven307.azurewebsites.net/profile-picture/${user.profilePicture}`;
const imageUrl = `https://safehaven2.azurewebsites.net/profile-picture/${user.profilePicture}`;
setProfilePicture(imageUrl);
} catch (error) {
console.error("Failed to load user profile picture", error);
Expand All @@ -49,14 +49,14 @@ function Profile() {

try {
// Send the file to the server for processing and storage in MongoDB
const response = await axios.post("safehaven307.azurewebsites.net/profile-picture", formData, {
const response = await axios.post("https://safehaven2.azurewebsites.net/profile-picture", formData, {
headers: addAuthHeader({
"Content-Type": "multipart/form-data"
})
});

console.log(response);
const imageUrl = `safehaven307.azurewebsites.net/profile-picture/${response.data}`;
const imageUrl = `https://safehaven2.azurewebsites.net/profile-picture/${response.data}`;

setProfilePicture(imageUrl);

Expand All @@ -68,7 +68,7 @@ function Profile() {
};

function deleteProfile() {
fetch("safehaven307.azurewebsites.net/users", {
fetch("https://safehaven2.azurewebsites.net/users", {
method: "DELETE",
headers: addAuthHeader({
"Content-Type": "application/json"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-frontend/src/Views/SignUpPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Signup() {
const navigate = useNavigate();
function createUser(user) {
console.log(user);
fetch("safehaven307.azurewebsites.net/users", {
fetch("https://safehaven2.azurewebsites.net/users", {
method: "POST",
headers: {
"Content-Type": "application/json"
Expand Down

0 comments on commit 134d705

Please sign in to comment.