[fix] solution: Threads OAuth 콜백 함수명이 React useCallback과 충돌 — 빌드 실패
solution-site 빌드가 TS2440(Import declaration conflicts with local declaration of 'useCallback')로 실패했다. FastAPI 라우트 핸들러 함수명이 `callback`이라 orval이 만든 React Query 훅 이름이 `useCallback`이 됐고, 같은 파일에서 import한 React의 useCallback과 이름이 겹쳤다. - router/v1/social/oauth.py: 함수명 callback → oauth_callback - 백엔드 재빌드 후 npm run orval 로 재생성 → useOauthCallback, callbackParams.ts → oauthCallbackParams.ts docker compose build solution-site 로 재검증, 정상 빌드 확인
This commit is contained in:
parent
23c9dd6fcd
commit
09d07ec0dd
@ -31,7 +31,7 @@ async def connect(response: Response, user: UserInfo = Depends(IsValidAccessToke
|
||||
|
||||
|
||||
@router.get("/callback")
|
||||
async def callback(
|
||||
async def oauth_callback(
|
||||
request: Request,
|
||||
state: str = Query("", max_length=2048),
|
||||
code: str = Query("", max_length=4096),
|
||||
|
||||
@ -11,7 +11,6 @@ export * from "./auditCheckData";
|
||||
export * from "./auditCheckDataRecommendation";
|
||||
export * from "./authProvider";
|
||||
export * from "./buildStatus";
|
||||
export * from "./callbackParams";
|
||||
export * from "./checkSlugParams";
|
||||
export * from "./decision";
|
||||
export * from "./errorInfo";
|
||||
@ -107,6 +106,7 @@ export * from "./mySiteDataSiteId";
|
||||
export * from "./mySiteDataStatus";
|
||||
export * from "./mySiteDataTemplateId";
|
||||
export * from "./mySiteDataThumbnailUrl";
|
||||
export * from "./oauthCallbackParams";
|
||||
export * from "./placeCandidate";
|
||||
export * from "./placeCandidateAddress";
|
||||
export * from "./placeCandidateCategoryName";
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type CallbackParams = {
|
||||
export type OauthCallbackParams = {
|
||||
/**
|
||||
* @maxLength 2048
|
||||
*/
|
||||
@ -2825,7 +2825,7 @@ export const useApproveMyPost = <
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
};
|
||||
/**
|
||||
* @summary 지금 발송하기 — 아침 9시 스윕을 기다리지 않고 이 업장의 오늘 몫을 바로 보낸다
|
||||
* @summary 승인 알림보내기 — 아침 9시 스윕을 기다리지 않고 이 업장의 오늘 몫을 바로 보낸다
|
||||
*/
|
||||
export const sendMyPostsNow = (
|
||||
placeId: string,
|
||||
@ -2883,7 +2883,7 @@ export type SendMyPostsNowMutationResult = NonNullable<
|
||||
export type SendMyPostsNowMutationError = HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary 지금 발송하기 — 아침 9시 스윕을 기다리지 않고 이 업장의 오늘 몫을 바로 보낸다
|
||||
* @summary 승인 알림보내기 — 아침 9시 스윕을 기다리지 않고 이 업장의 오늘 몫을 바로 보낸다
|
||||
*/
|
||||
export const useSendMyPostsNow = <
|
||||
TError = HTTPValidationError,
|
||||
|
||||
@ -20,14 +20,12 @@ import type {
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
|
||||
import { useCallback } from "react";
|
||||
|
||||
import type {
|
||||
ApprovalParams,
|
||||
CallbackParams,
|
||||
Decision,
|
||||
HTTPValidationError,
|
||||
LinkDecision,
|
||||
OauthCallbackParams,
|
||||
TestPost,
|
||||
} from ".././model";
|
||||
|
||||
@ -994,10 +992,10 @@ export const useConnect = <TError = unknown, TContext = unknown>(
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
};
|
||||
/**
|
||||
* @summary Callback
|
||||
* @summary Oauth Callback
|
||||
*/
|
||||
export const callback = (
|
||||
params?: CallbackParams,
|
||||
export const oauthCallback = (
|
||||
params?: OauthCallbackParams,
|
||||
options?: SecondParameter<typeof customFetch>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
@ -1007,56 +1005,56 @@ export const callback = (
|
||||
);
|
||||
};
|
||||
|
||||
export const getCallbackQueryKey = (params?: CallbackParams) => {
|
||||
export const getOauthCallbackQueryKey = (params?: OauthCallbackParams) => {
|
||||
return [`/v1/social/oauth/callback`, ...(params ? [params] : [])] as const;
|
||||
};
|
||||
|
||||
export const getCallbackQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof callback>>,
|
||||
export const getOauthCallbackQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: CallbackParams,
|
||||
params?: OauthCallbackParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof callback>>, TError, TData>
|
||||
UseQueryOptions<Awaited<ReturnType<typeof oauthCallback>>, TError, TData>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getCallbackQueryKey(params);
|
||||
const queryKey = queryOptions?.queryKey ?? getOauthCallbackQueryKey(params);
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof callback>>> = ({
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof oauthCallback>>> = ({
|
||||
signal,
|
||||
}) => callback(params, requestOptions, signal);
|
||||
}) => oauthCallback(params, requestOptions, signal);
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof callback>>,
|
||||
Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type CallbackQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof callback>>
|
||||
export type OauthCallbackQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof oauthCallback>>
|
||||
>;
|
||||
export type CallbackQueryError = HTTPValidationError;
|
||||
export type OauthCallbackQueryError = HTTPValidationError;
|
||||
|
||||
export function useCallback<
|
||||
TData = Awaited<ReturnType<typeof callback>>,
|
||||
export function useOauthCallback<
|
||||
TData = Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params: undefined | CallbackParams,
|
||||
params: undefined | OauthCallbackParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof callback>>, TError, TData>
|
||||
UseQueryOptions<Awaited<ReturnType<typeof oauthCallback>>, TError, TData>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof callback>>,
|
||||
Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof callback>>
|
||||
Awaited<ReturnType<typeof oauthCallback>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
@ -1066,20 +1064,20 @@ export function useCallback<
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useCallback<
|
||||
TData = Awaited<ReturnType<typeof callback>>,
|
||||
export function useOauthCallback<
|
||||
TData = Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: CallbackParams,
|
||||
params?: OauthCallbackParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof callback>>, TError, TData>
|
||||
UseQueryOptions<Awaited<ReturnType<typeof oauthCallback>>, TError, TData>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof callback>>,
|
||||
Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof callback>>
|
||||
Awaited<ReturnType<typeof oauthCallback>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
@ -1089,14 +1087,14 @@ export function useCallback<
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useCallback<
|
||||
TData = Awaited<ReturnType<typeof callback>>,
|
||||
export function useOauthCallback<
|
||||
TData = Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: CallbackParams,
|
||||
params?: OauthCallbackParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof callback>>, TError, TData>
|
||||
UseQueryOptions<Awaited<ReturnType<typeof oauthCallback>>, TError, TData>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
@ -1105,17 +1103,17 @@ export function useCallback<
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Callback
|
||||
* @summary Oauth Callback
|
||||
*/
|
||||
|
||||
export function useCallback<
|
||||
TData = Awaited<ReturnType<typeof callback>>,
|
||||
export function useOauthCallback<
|
||||
TData = Awaited<ReturnType<typeof oauthCallback>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: CallbackParams,
|
||||
params?: OauthCallbackParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof callback>>, TError, TData>
|
||||
UseQueryOptions<Awaited<ReturnType<typeof oauthCallback>>, TError, TData>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
@ -1123,7 +1121,7 @@ export function useCallback<
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getCallbackQueryOptions(params, options);
|
||||
const queryOptions = getOauthCallbackQueryOptions(params, options);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user