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

[GGFE-13] Admin - Feedback #786

Merged
merged 5 commits into from
May 30, 2023
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
28 changes: 16 additions & 12 deletions components/admin/feedback/FeedbackTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const tableTitle: { [key: string]: string } = {
intraId: 'intra ID',
category: 'μ’…λ₯˜',
content: 'λ‚΄μš©',
createdTime: '생성일',
createdAt: '생성일',
isSolved: 'ν•΄κ²° μ—¬λΆ€',
};

Expand All @@ -31,7 +31,7 @@ export interface IFeedback {
intraId: string;
category: number; // 1: bug, 2: suggestion, 3: question
content: string;
createdTime: Date;
createdAt: Date;
isSolved: boolean;
}

Expand All @@ -56,21 +56,21 @@ export default function FeedbackTable() {
const getUserFeedbacks = useCallback(async () => {
try {
const res = await instanceInManage.get(
`/feedback/users?q=${intraId}&page=${currentPage}&size=10`
`/feedback?intraId=${intraId}&page=${currentPage}&size=10`
);
setIntraId(intraId);
setFeedbackInfo({
feedbackList: res.data.feedbackList.map((feedback: IFeedback) => {
const { year, month, date, hour, min } = getFormattedDateToString(
new Date(feedback.createdTime)
new Date(feedback.createdAt)
);
return {
...feedback,
createdTime: `${year}-${month}-${date} ${hour}:${min}`,
createdAt: `${year}-${month}-${date} ${hour}:${min}`,
};
}),
totalPage: res.data.totalPage,
currentPage: res.data.currentPage,
currentPage: currentPage,
});
} catch (e) {
console.error('MS04');
Expand All @@ -85,15 +85,15 @@ export default function FeedbackTable() {
setFeedbackInfo({
feedbackList: res.data.feedbackList.map((feedback: IFeedback) => {
const { year, month, date, hour, min } = getFormattedDateToString(
new Date(feedback.createdTime)
new Date(feedback.createdAt)
);
return {
...feedback,
createdTime: `${year}-${month}-${date} ${hour}:${min}`,
createdAt: `${year}-${month}-${date} ${hour}:${min}`,
};
}),
totalPage: res.data.totalPage,
currentPage: res.data.currentPage,
currentPage: currentPage,
});
} catch (e) {
console.error('MS03');
Expand Down Expand Up @@ -165,9 +165,13 @@ export default function FeedbackTable() {
<option value='0'>μ²˜λ¦¬μ€‘</option>
<option value='1'>μ²˜λ¦¬μ™„λ£Œ</option>
</select>
) : value.toString().length > MAX_CONTENT_LENGTH ? (
) : (value?.toString() || '').length >
MAX_CONTENT_LENGTH ? (
<div>
{value.toString().slice(0, MAX_CONTENT_LENGTH)}
{(value?.toString() || '').slice(
0,
MAX_CONTENT_LENGTH
)}
<span
style={{ cursor: 'pointer', color: 'grey' }}
onClick={() => openDetailModal(feedback)}
Expand All @@ -176,7 +180,7 @@ export default function FeedbackTable() {
</span>
</div>
) : (
value.toString()
value?.toString() || ''
)}
</TableCell>
);
Expand Down
8 changes: 4 additions & 4 deletions components/modal/admin/AdminFeedbackCheckModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export default function AdminFeedbackCheck({

const sendNotificationHandler = async (isSend: boolean) => {
try {
await instanceInManage.put(`/feedback/is-solved`, {
feedbackId: id,
await instanceInManage.patch(`/feedback/${id}`, {
isSolved: isSolved,
});
await instanceInManage.post(`/notifications/${intraId}`, {
await instanceInManage.post(`/notifications`, {
intraId,
message: isSolved
? 'ν”Όλ“œλ°±μ„ κ²€ν† μ€‘μž…λ‹ˆλ‹€.'
: 'ν”Όλ“œλ°±μ΄ λ°˜μ˜λ˜μ—ˆμŠ΅λ‹ˆλ‹€.',
sendMail: isSend,
// sendMail: isSend, todo: μŠ¬λž™μœΌλ‘œ λ³΄λ‚΄λŠ” κ²ƒμœΌλ‘œ λ³€κ²½
});
setModal({ modalName: null });
} catch (e) {
Expand Down