Skip to content

Commit 76ca717

Browse files
authored
feat: complaint page (App) (#320) (#321)
* feat: complaint page (App) (#320) * fix: build err test (#320)
1 parent ae20099 commit 76ca717

File tree

62 files changed

+1351
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1351
-146
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = {
3838
'unused-imports/no-unused-imports': 'error',
3939
// emotion css props
4040
'react/no-unknown-property': ['error', { ignore: ['css'] }],
41+
'react/prop-types': 'off',
4142
},
4243
overrides: [
4344
{

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ COPY .nx ./
1616

1717
RUN pnpm install
1818

19-
RUN pnpm add -w sharp
20-
2119
ENV NEXT_TELEMETRY_DISABLED=1
2220

2321
RUN pnpm nextjs:build
Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,49 @@
1-
export {};
1+
import { appendFilesToFormData, createJsonBlob, extractFormData } from '@ahhachul/utils';
2+
3+
import axiosInstance from '@/apis/fetcher';
4+
import type { ApiResponse, CommentList, PaginatedList, WithPostId } from '@/types';
5+
import type {
6+
ComplaintForm,
7+
ComplaintListParams,
8+
ComplaintPost,
9+
ComplaintPostDetail,
10+
} from '@/types/complaint';
11+
12+
export const fetchComplaintList = async (req: ComplaintListParams) => {
13+
const { data } = await axiosInstance.get<ApiResponse<PaginatedList<ComplaintPost>>>(
14+
'/complaint-posts',
15+
{
16+
params: {
17+
...req,
18+
pageSize: 10,
19+
},
20+
},
21+
);
22+
return data;
23+
};
24+
25+
export const createComplaint = async (req: ComplaintForm) => {
26+
const formData = new FormData();
27+
const formDataWithoutImages = extractFormData(req, 'images');
28+
const jsonBlob = createJsonBlob(formDataWithoutImages);
29+
30+
formData.append('content', jsonBlob);
31+
32+
if (req.images?.length) {
33+
appendFilesToFormData(formData, req.images);
34+
}
35+
36+
const { data } = await axiosInstance.post<ApiResponse<WithPostId>>('/complaint-posts', formData, {
37+
headers: {
38+
'Content-Type': 'multipart/form-data',
39+
},
40+
});
41+
42+
return data;
43+
};
44+
45+
export const fetchComplaintDetail = (id: number) =>
46+
axiosInstance.get<ApiResponse<ComplaintPostDetail>>(`/complaint-posts/${id}`);
47+
48+
export const fetchComplaintCommentList = (id: number) =>
49+
axiosInstance.get<ApiResponse<CommentList>>(`/complaint-posts/${id}/comments`);

services/ahhachul.com/src/apis/request/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './user';
33
export * from './token';
44
export * from './lostFound';
55
export * from './community';
6+
export * from './complaint';
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 11 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export { default as ArrowMiniIcon } from './ic_arrow.svg?react';
2+
export { default as EmergencyIcon } from './ic_emergency.svg?react';
3+
export { default as HitIcon } from './ic_hit.svg?react';
4+
export { default as MetroIcon } from './ic_metro.svg?react';
5+
export { default as TreeIcon } from './ic_tree.svg?react';

0 commit comments

Comments
 (0)