Skip to content

Commit

Permalink
all front code with right domain url
Browse files Browse the repository at this point in the history
  • Loading branch information
bakgom123 committed Jan 4, 2025
1 parent 3a06a5e commit dd3f1f6
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion frontend/public/components/lottie-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LottieHeader extends HTMLElement {

try {
const response = await fetch(
`http://43.203.237.161/api/user/profile-image/${email}`,
`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/user/profile-image/${email}`,
{
headers: {
Accept: 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/components/main-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MainHeader extends HTMLElement {

try {
const response = await fetch(
`http://43.203.237.161/api/user/profile-image/${email}`,
`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/user/profile-image/${email}`,
{
headers: {
Accept: 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/js/change-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class passwordForm {
try {
const response = await fetch(
//'http://localhost:3000/user/change-password',
'http://43.203.237.161/api/user/change-password',
'http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/user/change-password',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/js/create-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const submitPost = async () => {
//{
// const response = await fetch(
// '/api/posts/create-post',
'http://43.203.237.161/api/posts/create-post',
'http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/posts/create-post',
{
method: 'POST',
body: formData,
Expand Down
6 changes: 3 additions & 3 deletions frontend/public/js/edit-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
async function fetchPost(postId) {
try {
//const response = await fetch(`http://localhost:3000/posts/${postId}`);
const response = await fetch(`http://43.203.237.161/api/posts/${postId}`);
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/posts/${postId}`);
if (!response.ok) {
throw new Error('게시글을 가져오는 데 실패했습니다.');
}
Expand All @@ -32,7 +32,7 @@ function populateForm(post) {
const imagePreview = document.getElementById('imagePreview');
if (post.image && imagePreview) {
//imagePreview.src = `http://localhost:3000/posts/${post.image}`;
imagePreview.src = `http://43.203.237.161/api/posts/${post.image}`;
imagePreview.src = `http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/posts/${post.image}`;
imagePreview.style.display = 'block';
}

Expand Down Expand Up @@ -71,7 +71,7 @@ async function reSubmitPost() {
try {
// 서버에 게시글 수정 요청
//const response = await fetch(`http://localhost:3000/posts/${postId}`, {
const response = await fetch(`http://43.203.237.161/api/posts/${postId}`, {
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/posts/${postId}`, {
method: 'PUT',
body: formData,
});
Expand Down
6 changes: 3 additions & 3 deletions frontend/public/js/edit-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ document.addEventListener('DOMContentLoaded', function () {
const email = localStorage.getItem('email');
// 서버에 탈퇴 요청
// fetch('http://localhost:3000/auth/withdraw', {
fetch('http://43.203.237.161/api/auth/withdraw', {
fetch('http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/auth/withdraw', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -143,7 +143,7 @@ document.addEventListener('DOMContentLoaded', function () {
reader.onload = async () => {
await fetch(
// 'http://localhost:3000/user/update-profile-image',
'http://43.203.237.161/api/user/update-profile-image',
'http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/user/update-profile-image',
{
method: 'POST',
headers: {
Expand All @@ -161,7 +161,7 @@ document.addEventListener('DOMContentLoaded', function () {
// 닉네임 업데이트
const nicknameResponse = await fetch(
//'http://localhost:3000/user/update-nickname',
'http://43.203.237.161/api/user/update-nickname',
'http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/user/update-nickname',
{
method: 'POST',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/js/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export async function handleLogout() {
try {
const response = await fetch(
//'http://localhost:3000/auth/logout', {
'http://43.203.237.161/api/auth/logout', {
'http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/auth/logout', {
method: 'POST',
credentials: 'include',
});
Expand Down
24 changes: 12 additions & 12 deletions frontend/public/js/post-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const CLOUDFRONT_DOMAIN = 'd2t2xvt037aek.cloudfront.net';
*/
async function fetchUserProfile(email) {
try {
const response = await fetch(`http://43.203.237.161/api/user/profile-image/${email}`, {
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/user/profile-image/${email}`, {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Expand Down Expand Up @@ -102,7 +102,7 @@ async function toggleLike(postId) {
// 서버에 좋아요 상태 변경 요청
const response = await fetch(
// `http://localhost:3000/likes/${postId}`,
`http://43.203.237.161/api/likes/${postId}`,
`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/likes/${postId}`,
{
method: 'POST',
headers: {
Expand Down Expand Up @@ -169,7 +169,7 @@ async function checkLikeStatus(postId) {
try {
const response = await fetch(
// `http://localhost:3000/likes/check/${postId}?email=${email}`,
`http://43.203.237.161/api/likes/check/${postId}?email=${email}`,
`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/likes/check/${postId}?email=${email}`,
{
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -213,13 +213,13 @@ async function fetchPost(postId) {
try {
// 조회수 증가 요청
// await fetch(`http://localhost:3000/views/${postId}`, {
await fetch(`http://43.203.237.161/api/views/${postId}`, {
await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/views/${postId}`, {
method: 'POST',
});

// 게시글 데이터 요청
// const response = await fetch(`http://localhost:3000/posts/${postId}`);
const response = await fetch(`http://43.203.237.161/api/posts/${postId}`);
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/posts/${postId}`);

if (!response.ok) {
throw new Error('게시글 가져오기 실패');
Expand All @@ -235,7 +235,7 @@ async function fetchPost(postId) {
// `http://localhost:3000/user/profile-image/${data.post.author_email}`,
// );
const profileResponse = await fetch(
`http://43.203.237.161/api/user/profile-image/${data.post.author_email}`
`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/user/profile-image/${data.post.author_email}`
);
const profileData = await profileResponse.json();

Expand Down Expand Up @@ -331,7 +331,7 @@ async function displayPost(post) {
async function handlePostDelete(postId) {
try {
// const response = await fetch(`http://localhost:3000/posts/${postId}`, {
const response = await fetch(`http://43.203.237.161/api/posts/${postId}`, {
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/posts/${postId}`, {
method: 'DELETE',
});

Expand Down Expand Up @@ -374,7 +374,7 @@ async function submitComment(postId) {

try {
// const response = await fetch('http://localhost:3000/comments', {
const response = await fetch('http://43.203.237.161/api/comments', {
const response = await fetch('http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/comments', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -431,7 +431,7 @@ async function deleteComment(commentId) {
// const response = await fetch(
// `http://localhost:3000/comments/${commentId}`,
// {
const response = await fetch(`http://43.203.237.161/api/comments/${commentId}`, {
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/comments/${commentId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -480,7 +480,7 @@ async function fetchCommentCount(postId) {
// const response = await fetch(
// `http://localhost:3000/comments/${postId}`,
// );
const response = await fetch(`http://43.203.237.161/api/comments/${postId}`);
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/comments/${postId}`);
if (!response.ok) throw new Error('댓글 가져오기 실패');
const comments = await response.json();
return Array.isArray(comments) ? comments.length : 0;
Expand All @@ -499,7 +499,7 @@ async function fetchComments(postId) {
// const response = await fetch(
// `http://localhost:3000/comments/${postId}`,
// );
const response = await fetch(`http://43.203.237.161/api/comments/${postId}`);
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/comments/${postId}`);
if (!response.ok) throw new Error('댓글 가져오기 실패');

const data = await response.json();
Expand Down Expand Up @@ -634,7 +634,7 @@ function setupCommentEventListeners(commentItem, commentId) {
// const response = await fetch(
// `http://localhost:3000/comments/${commentId}`,
// {
const response = await fetch(`http://43.203.237.161/api/comments/${commentId}`, {
const response = await fetch(`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/comments/${commentId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/js/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function fetchPosts(page = 1) {
isLoading = true;
const response = await fetch(
//`http://localhost:3000/posts?page=${page}&limit=${postsPerPage}`,
`http://43.203.237.161/api/posts?page=${page}&limit=${postsPerPage}`,
`http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/posts?page=${page}&limit=${postsPerPage}`,
);

if (!response.ok) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/js/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class SignupForm {
nickname: this.nicknameInput.value,
profileImage: this.profileImageData || 'default.webp',
};
fetch('http://43.203.237.161/api/auth/signup', {
fetch('http://David-kakao-community-env-backend.eba-an3dmmwe.ap-northeast-2.elasticbeanstalk.com/api/auth/signup', {
//fetch('http://localhost:3000/auth/signup', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
Expand Down

0 comments on commit dd3f1f6

Please sign in to comment.