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
4 changes: 1 addition & 3 deletions src/features/auth/ui/sign-up-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export default function SignupModal({
}) {
const [name, setName] = useState('');
const [checked, setChecked] = useState<boolean>(false);
const [image, setImage] = useState(
getCookie('socialImageURL') || 'profile-default.svg',
);
const [image, setImage] = useState(getCookie('socialImageURL') || undefined);
const fileInputRef = useRef<HTMLInputElement>(null);

const signUp = useSignUpMutation();
Expand Down
2 changes: 0 additions & 2 deletions src/features/my-page/consts/my-page-const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,3 @@ export const MBTI_OPTIONS = [
{ label: 'ENFJ', value: 'ENFJ' },
{ label: 'ENTJ', value: 'ENTJ' },
];

export const DEFAULT_PROFILE_IMAGE_URL = '/profile-default.svg';
12 changes: 4 additions & 8 deletions src/features/my-page/ui/profile-edit-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ import MultiItemSelector from '@/shared/ui/form/multi-item-selector';
import { BaseInput, TextAreaInput } from '@/shared/ui/input';
import { Modal } from '@/shared/ui/modal';

import {
DEFAULT_OPTIONS,
DEFAULT_PROFILE_IMAGE_URL,
MBTI_OPTIONS,
} from '../consts/my-page-const';
import { DEFAULT_OPTIONS, MBTI_OPTIONS } from '../consts/my-page-const';
import {
ProfileFormSchema,
type ProfileFormInput,
Expand Down Expand Up @@ -83,7 +79,7 @@ function ProfileEditForm({

const [image, setImage] = useState(
memberProfile.profileImage?.resizedImages?.[0]?.resizedImageUrl ??
DEFAULT_PROFILE_IMAGE_URL,
undefined,
);

const methods = useForm<ProfileFormInput>({
Expand All @@ -100,7 +96,7 @@ function ProfileEditForm({
const onValidSubmit = async (values: ProfileFormValues) => {
const file = fileInputRef.current?.files?.[0];
const profileImageExtension =
image === DEFAULT_PROFILE_IMAGE_URL ? 'jpg' : file?.name.split('.').pop();
image === undefined ? 'jpg' : file?.name.split('.').pop();

const payload = toUpdateProfilePayload(values, { profileImageExtension });
const updatedProfile = await updateProfile(payload);
Expand All @@ -111,7 +107,7 @@ function ProfileEditForm({

if (file) {
imageFormData.append('file', file);
} else if (image === DEFAULT_PROFILE_IMAGE_URL) {
} else if (image === undefined) {
const defaultProfileImage = 'profile-default.jpg';
const response = await fetch(defaultProfileImage);
const blob = await response.blob();
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/home/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default async function Header() {
const userInfo = userProfile?.memberProfile;
const userImg = userProfile
? userInfo?.profileImage?.resizedImages[0].resizedImageUrl
: 'profile-default.svg';
: undefined;

return (
<header
Expand Down