Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeploymentChanges #139

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front-end/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import App from './App';
import axios from 'axios';

// base URL for all Axios requests
axios.defaults.baseURL = 'http://localhost:3001/api';
axios.defaults.baseURL = 'http://readtrack-yi3cj.ondigitalocean.app/';

// using interceptor to attach the token to every request
axios.interceptors.request.use(function (config) {
Expand Down
6 changes: 3 additions & 3 deletions front-end/src/pages/Book.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const BookPage = ({ loggedInUser }) => {
const toggleFavorite = () => {
const token = localStorage.getItem("token");

fetch(`http://localhost:3001/api/users/${loggedInUser._id}/favorites`, {
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}/favorites`, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
Expand All @@ -49,7 +49,7 @@ const BookPage = ({ loggedInUser }) => {
useEffect(() => {
const token = localStorage.getItem("token");
if (bookId && token) {
fetch(`http://localhost:3001/api/books/${bookId}`, {
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/books/${bookId}`, {
method: "GET",
headers: {
'Authorization': `Bearer ${token}`,
Expand Down Expand Up @@ -84,7 +84,7 @@ const BookPage = ({ loggedInUser }) => {

setIsFavorite(bookData.isFavorite);

fetch(`http://localhost:3001/api/users/${loggedInUser._id}/books`, {
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}/books`, {
method: "GET",
headers: {
'Authorization': `Bearer ${token}`,
Expand Down
4 changes: 2 additions & 2 deletions front-end/src/pages/BookSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const BookSearchPage = () => {
}, []);

const fetchAllBooks = () => {
const apiUrl = `http://localhost:3001/api/books`;
const apiUrl = `https://readtrack-yi3cj.ondigitalocean.app/api/books`;
const token = localStorage.getItem('token');
const headers = {
'Authorization': `Bearer ${token}`
Expand All @@ -37,7 +37,7 @@ const BookSearchPage = () => {
};

const handleSearch = (searchTerm) => {
const searchUrl = `http://localhost:3001/api/books/search?query=${encodeURIComponent(searchTerm)}`;
const searchUrl = `https://readtrack-yi3cj.ondigitalocean.app/api/books/search?query=${encodeURIComponent(searchTerm)}`;
const token = localStorage.getItem('token');
const headers = { 'Authorization': `Bearer ${token}` };

Expand Down
2 changes: 1 addition & 1 deletion front-end/src/pages/CurrentlyReading.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function CurrentlyReading({ userId, bookId, isAdded }) {
const token = localStorage.getItem("token");
const method = bookAdded ? "DELETE" : "POST";

fetch(`http://localhost:3001/api/users/${userId}/currentlyReading`, {
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${userId}/currentlyReading`, {
method: method,
headers: {
'Authorization': `Bearer ${token}`,
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/pages/Form/SignUpPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SignUpPage = ({ setLoggedInUser, loggedInUser, setRegisteredUser }) => {

const handleSubmit = (e) => {
e.preventDefault();
fetch('http://localhost:3001/api/register', {
fetch('https://readtrack-yi3cj.ondigitalocean.app/api/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/pages/Form/editProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const EditProfile = ({ loggedInUser, setLoggedInUser }) => {
const token = localStorage.getItem("token");
try {
const response = await fetch(
`http://localhost:3001/api/users/update/${loggedInUser._id}`,
`https://readtrack-yi3cj.ondigitalocean.app/api/users/update/${loggedInUser._id}`,
{
method: "PUT",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/pages/Form/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Login = ({ registeredUser, setLoggedInUser }) => {
}

try {
const response = await fetch('http://localhost:3001/api/login', {
const response = await fetch('https://readtrack-yi3cj.ondigitalocean.app/api/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions front-end/src/pages/Form/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ProfilePage = ({ loggedInUser, setLoggedInUser }) => {

const fetchUserProfile = async () => {
try {
const response = await fetch(`http://localhost:3001/api/users/${loggedInUser._id}`, {
const response = await fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
Expand All @@ -42,7 +42,7 @@ const ProfilePage = ({ loggedInUser, setLoggedInUser }) => {

const fetchBooks = async (endpoint, setBooks) => {
try {
const response = await fetch(`http://localhost:3001/api/users/${loggedInUser._id}/books/${endpoint}`, {
const response = await fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}/books/${endpoint}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/pages/Friends.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Friends = ({ loggedInUser, setLoggedInUser }) => {

useEffect(() => {
if (loggedInUser) {
fetch(`http://localhost:3001/api/users/${loggedInUser._id}`)
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}`)
.then((response) => response.json())
.then((data) => {
setProfile(data);
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/pages/ReadingFinished.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function ReadingFinished({ userId, bookId, isAdded }) {
const token = localStorage.getItem("token");
const method = bookAdded ? "DELETE" : "POST";

fetch(`http://localhost:3001/api/users/${userId}/finishedReading`, {
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${userId}/finishedReading`, {
method: method,
headers: {
'Authorization': `Bearer ${token}`,
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/pages/ReadingWishlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function ReadingWishlist({ userId, bookId, isAdded }) {
const token = localStorage.getItem("token");
const method = bookAdded ? "DELETE" : "POST";

fetch(`http://localhost:3001/api/users/${userId}/wishlist`, {
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/users/${userId}/wishlist`, {
method: method,
headers: {
Authorization: `Bearer ${token}`,
Expand Down
10 changes: 5 additions & 5 deletions front-end/src/pages/mainHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const MainHome = ({ loggedInUser, setLoggedInUser }) => {

const token = localStorage.getItem("token");
const urls = [
`http://localhost:3001/api/users/${loggedInUser._id}/books/currentReads`,
`http://localhost:3001/api/users/${loggedInUser._id}/books/friendsReads`,
`http://localhost:3001/api/users/${loggedInUser._id}/books/topReads`,
`http://localhost:3001/api/users/${loggedInUser._id}/books/suggestions`,
`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}/books/currentReads`,
`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}/books/friendsReads`,
`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}/books/topReads`,
`https://readtrack-yi3cj.ondigitalocean.app/api/users/${loggedInUser._id}/books/suggestions`,
];

try {
Expand Down Expand Up @@ -55,7 +55,7 @@ const MainHome = ({ loggedInUser, setLoggedInUser }) => {
// Fetch the full book details using the googleBookId
const fetchBookDetails = async (bookRefs) => {
const bookDetailsRequests = bookRefs.map((bookRef) =>
fetch(`http://localhost:3001/api/books/${bookRef.id}`, {
fetch(`https://readtrack-yi3cj.ondigitalocean.app/api/books/${bookRef.id}`, {
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
Expand Down
Loading