Skip to content

Commit 8e0dfdd

Browse files
authored
Merge pull request #145 from TEAM-COMFIT/fix/#143/onboarding-home-error
2 parents 296d95e + b971fdb commit 8e0dfdd

3 files changed

Lines changed: 39 additions & 47 deletions

File tree

src/features/company-detail/api/use-get-company-detail.query.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { companyQueryKey } from "@/shared/api/config/query-key";
77
import type { GetCompanyResponseDto } from "@/shared/api/generate/http-client";
88

99
export const getCompanyDetail = async (companyId: number) => {
10-
const response = await api.companies.getCompany(companyId);
10+
const response = await api.companies.getCompany(companyId, { secure: false });
1111
return response.result as unknown as GetCompanyResponseDto;
1212
};
1313

@@ -16,6 +16,7 @@ export const useGetCompanyDetail = (companyId: number) => {
1616
queryKey: companyQueryKey.detail(companyId),
1717
queryFn: () => getCompanyDetail(companyId),
1818
enabled: Number.isFinite(companyId) && companyId > 0,
19+
// secure: tr
1920
throwOnError: (error) =>
2021
!(isAxiosError(error) && error.response?.status === 404),
2122
});

src/features/home/ui/major-company-card/major-company-card.tsx

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { assignInlineVars } from "@vanilla-extract/dynamic";
22
import { useNavigate } from "react-router-dom";
33

4-
import {
5-
getCompanyDetail,
6-
getCompanySuggestions,
7-
} from "@/features/company-detail";
8-
import { queryClient } from "@/shared/api";
9-
import { companyQueryKey } from "@/shared/api/config/query-key";
4+
// import {
5+
// getCompanyDetail,
6+
// getCompanySuggestions,
7+
// } from "@/features/company-detail";
8+
// import { queryClient } from "@/shared/api";
9+
// import { companyQueryKey } from "@/shared/api/config/query-key";
1010
import { IconMove } from "@/shared/assets/icons";
1111
import { getScaleLabel } from "@/shared/config";
1212
import { Tag } from "@/shared/ui/tag/tag";
@@ -34,31 +34,29 @@ const MajorCompanyCard = ({
3434
}: MajorCompanyCardProps) => {
3535
const navigate = useNavigate();
3636

37-
const prefetchCompany = () => {
38-
void queryClient.prefetchQuery({
39-
queryKey: companyQueryKey.detail(id),
40-
queryFn: () => getCompanyDetail(id),
41-
});
42-
void queryClient.prefetchQuery({
43-
queryKey: companyQueryKey.suggestion(id),
44-
queryFn: () => getCompanySuggestions(id),
45-
});
46-
};
37+
// TODO: prefetch 기능 다시 살리기
38+
// const prefetchCompany = () => {
39+
// void queryClient.prefetchQuery({
40+
// queryKey: companyQueryKey.detail(id),
41+
// queryFn: () => getCompanyDetail(id),
42+
// });
43+
// void queryClient.prefetchQuery({
44+
// queryKey: companyQueryKey.suggestion(id),
45+
// queryFn: () => getCompanySuggestions(id),
46+
// });
47+
// };
4748

4849
const handleClick = () => {
4950
window.scrollTo({ top: 0, left: 0, behavior: "auto" });
50-
prefetchCompany();
51+
// prefetchCompany();
5152
navigate(`/company/${id}`);
5253
};
5354

5455
return (
5556
<button
5657
type="button"
5758
onClick={handleClick}
58-
onMouseEnter={prefetchCompany}
59-
onFocus={prefetchCompany}
60-
onTouchStart={prefetchCompany}
61-
aria-label="旮办梾 ?侅劯搿??措彊"
59+
aria-label="주요 기업 카드"
6260
className={styles.card({ type })}
6361
style={assignInlineVars({ [styles.bgImageUrl]: `url(${imgUrl})` })}
6462
>

src/widgets/company-card/company-analyze-button.tsx

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useNavigate } from "react-router-dom";
22

3-
import {
4-
getCompanyDetail,
5-
getCompanySuggestions,
6-
} from "@/features/company-detail";
7-
import { queryClient } from "@/shared/api";
8-
import { companyQueryKey } from "@/shared/api/config/query-key";
3+
// import {
4+
// getCompanyDetail,
5+
// getCompanySuggestions,
6+
// } from "@/features/company-detail";
7+
// import { queryClient } from "@/shared/api";
8+
// import { companyQueryKey } from "@/shared/api/config/query-key";
99
import { IconCompany } from "@/shared/assets/icons";
1010

1111
import * as styles from "./company-analyze-button.css";
@@ -17,32 +17,25 @@ interface CompanyAnalyzeButtonProps {
1717
const CompanyAnalyzeButton = ({ companyId }: CompanyAnalyzeButtonProps) => {
1818
const navigate = useNavigate();
1919

20-
const prefetchCompany = () => {
21-
void queryClient.prefetchQuery({
22-
queryKey: companyQueryKey.detail(companyId),
23-
queryFn: () => getCompanyDetail(companyId),
24-
});
25-
void queryClient.prefetchQuery({
26-
queryKey: companyQueryKey.suggestion(companyId),
27-
queryFn: () => getCompanySuggestions(companyId),
28-
});
29-
};
20+
// TODO: prefetch 기능 다시 살리기
21+
// const prefetchCompany = () => {
22+
// void queryClient.prefetchQuery({
23+
// queryKey: companyQueryKey.detail(companyId),
24+
// queryFn: () => getCompanyDetail(companyId),
25+
// });
26+
// void queryClient.prefetchQuery({
27+
// queryKey: companyQueryKey.suggestion(companyId),
28+
// queryFn: () => getCompanySuggestions(companyId),
29+
// });
30+
// };
3031

3132
const handleClick = () => {
3233
window.scrollTo({ top: 0, left: 0, behavior: "auto" });
33-
prefetchCompany();
3434
navigate(`/company/${companyId}`);
3535
};
3636

3737
return (
38-
<button
39-
type="button"
40-
className={styles.button}
41-
onClick={handleClick}
42-
onMouseEnter={prefetchCompany}
43-
onFocus={prefetchCompany}
44-
onTouchStart={prefetchCompany}
45-
>
38+
<button type="button" className={styles.button} onClick={handleClick}>
4639
<IconCompany className={styles.icon} />
4740
<span>기업 분석 보기</span>
4841
</button>

0 commit comments

Comments
 (0)