Skip to content
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
14 changes: 5 additions & 9 deletions src/app/(auth)/signup/actions/OAuthActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ export const OAuthActions = async (
) => {
const cookieStore = await cookies();
const authorizationCode = cookieStore.get("authorizationcode")?.value;
const oauthAccessToken = cookieStore.get("oauthAccessToken")?.value;

const providerRedirectUri =
role === "OWNER"
? provider === "kakao"
? `${process.env.NEXT_PUBLIC_KAKAO_OWNER_SIGNUP_REDIRECT_URL}`
: `${process.env.NEXT_PUBLIC_GOOGLE_OWNER_SIGNUP_REDIRECT_URL}`
: provider === "kakao"
? `${process.env.NEXT_PUBLIC_KAKAO_APPLICANT_SIGNUP_REDIRECT_URL}`
: `${process.env.NEXT_PUBLIC_GOOGLE_APPLICANT_SIGNUP_REDIRECT_URL}`;
? `${process.env.NEXT_PUBLIC_KAKAO_OWNER_SIGNUP_REDIRECT_URL}`
: `${process.env.NEXT_PUBLIC_KAKAO_APPLICANT_SIGNUP_REDIRECT_URL}`;

const data = {
location: formData.get("location")?.toString() || "",
Expand All @@ -31,7 +26,7 @@ export const OAuthActions = async (
nickname: formData.get("nickname")?.toString(),
name: formData.get("name")?.toString() || "",
redirectUri: providerRedirectUri,
token: authorizationCode || oauthAccessToken,
token: authorizationCode,
};

const result = OAuthSchema.safeParse(data);
Expand All @@ -56,8 +51,9 @@ export const OAuthActions = async (
);

const responseErrorText = {
400: "잘못된 인가코드입니다.",
400: "입력한 정보가 올바르지 않습니다.",
404: "잘못된 경로로의 요청입니다.",
409: "이미 가입된 회원입니다.",
500: "서버 오류가 발생했습니다.",
};

Expand Down
11 changes: 6 additions & 5 deletions src/components/button/ImageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const ImageInput = ({
const [error, setError] = useState<string | null>(null);
const fileInputRef = useRef<HTMLInputElement>(null);
const MAX_FILE_SIZE_MB = 5;
const selectedImagesRef = useRef(selectedImages);
selectedImagesRef.current = selectedImages;

// 크기별 클래스
const sizeClasses = {
Expand All @@ -41,14 +43,13 @@ const ImageInput = ({
// 임시저장 이미지가 있을 시 이를 감지하여 미리보기 이미지 표출
useEffect(() => {
if (initialImage?.length) {
selectedImages.forEach((url) => URL.revokeObjectURL(url));
selectedImagesRef.current.forEach((url) => URL.revokeObjectURL(url));

setSelectedImages(
initialImage.map((image) => URL.createObjectURL(image))
);
const newImages = initialImage.map((img) => URL.createObjectURL(img));
setSelectedImages(newImages);
setNewFiles(initialImage);
}
}, [initialImage, selectedImages]);
}, [initialImage]);

useEffect(() => {
return () => {
Expand Down