Skip to content

Commit

Permalink
Merge pull request #105 from Ureca-Dangdang-salon/develop
Browse files Browse the repository at this point in the history
배포 테스트
  • Loading branch information
skang9810 authored Dec 10, 2024
2 parents 43db7bf + 3d9dd9b commit e31959a
Show file tree
Hide file tree
Showing 72 changed files with 4,270 additions and 1,353 deletions.
1,060 changes: 1,052 additions & 8 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@mui/x-date-pickers": "^7.22.3",
"axios": "^1.7.8",
"dayjs": "^1.11.13",
"firebase": "^9.20.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
Expand Down
4 changes: 3 additions & 1 deletion public/_redirects
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/* /index.html 200
/* /index.html 200

https://dangdangsalon.netlify.app/* https://client.dangdang-salon.com/:s 301!
32 changes: 32 additions & 0 deletions public/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
self.importScripts(
'https://www.gstatic.com/firebasejs/9.20.0/firebase-app-compat.js'
);
self.importScripts(
'https://www.gstatic.com/firebasejs/9.20.0/firebase-messaging-compat.js'
);

const firebaseConfig = {
apiKey: 'AIzaSyDV1rn-AOUbRKnUrlZTWxs7DRmpLd7ZfY0',
authDomain: 'dangdangsalon-50432.firebaseapp.com',
projectId: 'dangdangsalon-50432',
storageBucket: 'dangdangsalon-50432.firebasestorage.app',
messagingSenderId: '441665534881',
appId: '1:441665534881:web:442db19619f35ba4f6a9e0',
measurementId: 'G-23L8ZGFYT0',
};

firebase.initializeApp(firebaseConfig);

const messaging = firebase.messaging();

messaging.onBackgroundMessage((payload) => {
console.log('Background message received:', payload);

const notificationTitle = payload.notification.title || 'Default Title';
const notificationOptions = {
body: payload.notification.body || 'Default Body',
icon: payload.notification.icon || '/default-icon.png',
};

self.registration.showNotification(notificationTitle, notificationOptions);
});
5 changes: 5 additions & 0 deletions src/api/apiClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import axios from 'axios';
import { handleError } from './handleError';

export const apiClient = axios.create({
baseURL: import.meta.env.VITE_BASE_URL,
withCredentials: true,
});

apiClient.interceptors.response.use((response) => {
return response;
}, handleError);
35 changes: 34 additions & 1 deletion src/api/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,44 @@ export const join = async (role, district_id) => {
}
};

export const tokenRefresh = async () => {
try {
const { data } = await apiClient.post(AuthController.refresh);
if (data.response === '액세스 토큰 갱신에 성공했습니다.') return true;
else return false;
} catch (e) {
console.error(e);
return false;
}
};

export const loginCheck = async () => {
try {
const { data } = await apiClient.get(AuthController.checkLogin);
if (data.response === '로그인이 되어있지 않습니다.') return false;
return !!data.response?.login;
return data.response;
} catch (e) {
console.log(e);
return false;
}
};

export const logout = async () => {
try {
const { data } = await apiClient.post(AuthController.logout);
if (data.response === '로그아웃에 성공했습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};

export const deleteAccount = async () => {
try {
const { data } = await apiClient.delete(AuthController.deleteAccount);
if (data.response === '회원탈퇴에 성공했습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
Expand Down
12 changes: 12 additions & 0 deletions src/api/contest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { apiClient } from './apiClient';
import { ContestController } from './requestUrls';

export const getContestRanking = async () => {
try {
const { data } = await apiClient.get(ContestController.rank);
return data.response || false;
} catch (e) {
console.log(e);
return false;
}
};
87 changes: 87 additions & 0 deletions src/api/contestApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { apiClient } from './apiClient';

export const fetchCurrentContest = async () => {
try {
const { data } = await apiClient.get('/api/contests');
return data.response;
} catch (error) {
console.error(error);
return null;
}
};

export const fetchContestDetails = async (contestId) => {
try {
const { data } = await apiClient.get(`/api/contests/${contestId}`);
return data.response;
} catch (error) {
console.error(error);
throw error;
}
};

export const fetchContestPayments = async (startDate, endDate) => {
try {
const { data } = await apiClient.post('/api/contests/payment', {
startDate,
endDate,
});
return data.response;
} catch (error) {
console.error(error);
return [];
}
};

export const postContestEntry = async (data) => {
try {
const res = await apiClient.post('/api/posts', data);
return res.response;
} catch (error) {
console.error(error);
throw error;
}
};

export const checkContestParticipation = async (contestId) => {
try {
const { data } = await apiClient.get(`/api/contests/${contestId}/check`);
return data.response;
} catch (error) {
console.error(error);
throw error;
}
};

export const getContestPosts = async (contestId, page, size) => {
try {
const { data } = await apiClient.get(`/api/contests/${contestId}/posts`, {
params: { page, size },
});
return data.response;
} catch (error) {
console.error(error);
throw error;
}
};

export const deletePost = async (postId) => {
try {
const { data } = await apiClient.delete(`/api/posts/${postId}`);
return data.response;
} catch (error) {
console.error(error);
throw error;
}
};

export const likePost = async (postId) => {
const { data } = await apiClient.post(`/api/posts/${postId}/like`);
return data.response;
};

export const unlikePost = async (postId) => {
const { data } = await apiClient.delete(`/api/posts/${postId}/like`);
return data.response;
};

76 changes: 76 additions & 0 deletions src/api/dogProfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { apiClient } from './apiClient';
import { ProfileController } from './requestUrls';

export const dogProfile = async (id) => {
try {
const url = `${ProfileController.dogProfile}/${id}`;
const { data } = await apiClient.get(url);
console.log(data);
return data.response;
} catch (e) {
console.log(e);
return false;
}
};

export const postDogProfile = async (petInfo) => {
try {
const { data } = await apiClient.post(ProfileController.dogProfile, {
name: petInfo.name,
profileImage: petInfo.profileImage,
species: petInfo.species,
ageYear: petInfo.ageYear,
ageMonth: petInfo.ageMonth,
gender: petInfo.gender,
neutering: petInfo.neutering,
weight: petInfo.weight,
featureIds: petInfo.featureIds,
additionalFeature: petInfo.additionalFeature,
});
if (data.response === '반려견 프로필 등록이 완료되었습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};

export const updateDogProfile = async (
newData,
id,
featureIds,
additionalFeature
) => {
try {
const url = `${ProfileController.dogProfile}/${id}`;
const { data } = await apiClient.put(url, {
name: newData.name,
profileImage: newData.profileImage,
species: newData.species,
ageYear: newData.ageYear,
ageMonth: newData.ageMonth,
gender: newData.gender,
neutering: newData.neutering,
weight: newData.weight,
featureIds: featureIds,
additionalFeature: additionalFeature,
});
if (data.response === '반려견 프로필 수정이 완료되었습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};

export const deleteDogProfile = async (id) => {
try {
const url = `${ProfileController.dogProfile}/${id}`;
const { data } = await apiClient.delete(url);
if (data.response === '반려견 프로필 삭제가 완료되었습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};
104 changes: 104 additions & 0 deletions src/api/groomerProfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { apiClient } from './apiClient';
import { ProfileController } from './requestUrls';

export const groomerProfile = async () => {
try {
const { data } = await apiClient.get(ProfileController.groomerProfile);
return data.response.groomerProfile;
} catch (e) {
console.log(e);
return false;
}
};

export const postGroomerProfile = async (groomerInfo) => {
try {
const { data } = await apiClient.post(ProfileController.groomerProfile, {
name: groomerInfo.name,
phone: groomerInfo.phone,
contactHours: groomerInfo.contactHours,
serviceType: groomerInfo.serviceType,
servicesOfferedId: groomerInfo.servicesOfferedId,
servicesDistrictIds: groomerInfo.servicesDistrictIds,
});
if (data.response === '미용사 프로필 등록이 완료되었습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};

export const postAddGroomerProfile = async (businessInfo) => {
try {
const { data } = await apiClient.post(
ProfileController.detailGroomerProfile,
{
imageKey: businessInfo.imageKey,
businessNumber: businessInfo.businessNumber,
address: businessInfo.address,
experience: businessInfo.experience,
certifications: businessInfo.certifications,
description: businessInfo.description,
startMessage: businessInfo.startMessage,
faq: businessInfo.faq,
}
);
if (data.response === '미용사 프로필 상세 정보 등록이 완료되었습니다.')
return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};

export const groomerPublicProfile = async (id) => {
try {
const url = `${ProfileController.groomerProfile}/${id}`;
const { data } = await apiClient.get(url);
return data.response;
} catch (e) {
console.log(e);
return false;
}
};

export const updateGroomerProfile = async (newData) => {
try {
const url = `${ProfileController.groomerProfile}/${newData.profileId}`;
const { data } = await apiClient.put(url, {
imageKey: newData.imageKey,
name: newData.name,
phone: newData.phone,
servicesDistrictIds: newData.servicesDistrictIds,
contactHours: newData.contactHours,
servicesOfferedId: newData.servicesOfferedId,
serviceType: newData.serviceType,
businessNumber: newData.businessNumber,
address: newData.address,
experience: newData.experience,
certifications: newData.certifications,
description: newData.description,
startMessage: newData.startMessage,
faq: newData.faq,
});
if (data.response === '미용사 프로필 수정이 완료되었습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};

export const deleteGroomerProfile = async (id) => {
try {
const url = `${ProfileController.groomerProfile}/${id}`;
const { data } = await apiClient.delete(url);
if (data.response === '미용사 프로필 삭제가 완료되었습니다.') return true;
else return false;
} catch (e) {
console.log(e);
return false;
}
};
Loading

0 comments on commit e31959a

Please sign in to comment.