Skip to content

Commit 272f700

Browse files
committed
Edit patron model
1 parent 053cc2f commit 272f700

File tree

4 files changed

+15
-44
lines changed

4 files changed

+15
-44
lines changed

src/api/sponsor.ts

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -89,37 +89,14 @@ export function listSponsorBenefits(): Promise<SponsorBenefit[]> {
8989

9090
export function listPatrons(): Promise<Patron[]> {
9191
return new Promise((resolve, reject) => {
92-
resolve([
93-
{
94-
name: "김파이썬",
95-
message: "후원 합니다! ",
96-
sequence: 1,
97-
},
98-
{
99-
name: "이파이썬",
100-
message: "후원 합니다!",
101-
sequence: 2,
102-
},
103-
{
104-
name: "이파이썬",
105-
message: "",
106-
sequence: 3,
107-
},
108-
{
109-
name: "이파이썬",
110-
message: "후원 합니다!",
111-
sequence: 4,
112-
},
113-
]);
114-
115-
// instance
116-
// .get<APIPatron[]>("${process.env.REACT_APP_PYCONKR_SHOP_API}/2024/sponsors/benefits/")
117-
// .then((response) => {
118-
// resolve(Patron.fromAPIs(response.data));
119-
// })
120-
// .catch((error) => {
121-
// console.error(error);
122-
// reject(getErrorMessage(error));
123-
// });
92+
instance
93+
.get<APIPatron[]>(`${process.env.REACT_APP_PYCONKR_SHOP_API}/v1/ext/patron/`)
94+
.then((response) => {
95+
resolve(Patron.fromAPIs(response.data));
96+
})
97+
.catch((error) => {
98+
console.error(error);
99+
reject(getErrorMessage(error));
100+
});
124101
});
125102
}

src/models/api/sponsor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,4 @@ export type APISponsorLevelWithSponsor = {
4949
export type APIPatron = {
5050
name: string;
5151
message?: string | null;
52-
sequence: number;
5352
};

src/models/sponsor.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,16 @@ export class Sponsor {
180180
export class Patron {
181181
name: string;
182182
message?: string | null;
183-
sequence: number;
184183

185184
private constructor(p: Patron) {
186185
this.name = p.name;
187186
this.message = p.message;
188-
this.sequence = p.sequence;
189187
}
190188

191189
static fromAPI(d: APIPatron): Patron {
192190
return new Patron({
193191
name: d.name,
194192
message: d.message,
195-
sequence: d.sequence,
196193
});
197194
}
198195

src/pages/Sponsor/patron.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ const PatronList = () => {
3737
{t("후원해주셔서 감사합니다.")}
3838
</p>
3939

40-
{patrons
41-
.sort((a, b) => a.sequence - b.sequence)
42-
.map((p) => (
43-
<PatronContainer key={`${p.name}-${p.sequence}`}>
44-
<h4>{p.name}</h4>
45-
<div>{p.message}</div>
46-
</PatronContainer>
47-
))}
40+
{patrons.map((p, idx) => (
41+
<PatronContainer key={`${p.name}-${idx}`}>
42+
<h4>{p.name}</h4>
43+
<div>{p.message}</div>
44+
</PatronContainer>
45+
))}
4846
</Page>
4947
);
5048
};

0 commit comments

Comments
 (0)