Skip to content

[feat/#337] 사용자 로그인 정보 API 연동 & 프로필 사진 삭제 구현#341

Merged
SeungWon1125 merged 12 commits intodevelopfrom
feat/#337-login-info-api
Nov 19, 2025
Merged

[feat/#337] 사용자 로그인 정보 API 연동 & 프로필 사진 삭제 구현#341
SeungWon1125 merged 12 commits intodevelopfrom
feat/#337-login-info-api

Conversation

@SeungWon1125
Copy link
Copy Markdown
Collaborator

@SeungWon1125 SeungWon1125 commented Nov 18, 2025

📄 작업 내용

  • 사용자 로그인 정보 API 연동했습니다.
  • 프로필 사진 삭제 기능을 추가했습니다.
구현 내용 iPhone 13 mini
로그인 정보 & 프로필 이미지 삭제

💻 주요 코드 설명

Interceptor 수정이 필요했어요

사용자 로그인 정보 API가 추가되었는데요
path가 "/auth/login-info"로 추가되었습니다.
여기서 문제가 되었는데요

// Interceptor.swift
...
private let skipAuthKeywords: [String] = [
    "/auth/login", //<- 이 경로가 추가되어 있었음
    "/auth/social",
    "/auth/refresh"
]

"/auth/login" 경로에 포함되어 헤더에 accessToken이 안 붙어서 자꾸 로그인 정보가 nil이더라고요
(서버 문제인 줄 알고,, 또 민규형을 괴롭혓ㅆ다.._..ㅠ)
스웨거랑 명세서 확인하니까 "/auth/login" 경로의 API가 로그인 정보 말고 없었습니다
결론 -> "/auth/login" 삭제함

func shouldSkipAuth(for path: String) -> Bool {
    skipAuthKeywords.contains { path.contains($0) } // 원래 코드
    skipAuthKeywords.contains { path.hasPrefix($0) } // 수정된 코드
}

추가적으로 좀 더 확실하게 하기 위해 .hasPrefix()로 바꿔놨습니다
-> skip할 path 문자열로 시작하면 true => 헤더에 토큰 안 붙임


프로필 사진 삭제 구현

이슈 파기 귀찮아서 여기서 구현했어요
서버에서 회원 정보 수정 API를 request를 아래와 같이 요구했습니다.

  1. profileImageFileKey에 값이 있으면 -> 새로운 이미지로 수정
  2. profileImageFileKey에 값이 nil이면 -> 기존 이미지를 사용(원래 설정해놨던 사진)
  3. profileImageFileKey에 값이 ""이면 -> 기본 이미지를 사용(프로필 사진 삭제)

1️⃣ 먼저 MyPageEdit 상태 관리

// MyPageEditReducer.swift
case .deleteProfileImage:
    state.attachedImageData = ("", Data())
    state.isUserInformationChanged = true
    break

그래서 먼저 delete하는 action을 추가한 후, statestate.attachedImageData에 빈 값을 넣는 방식으로 구현했어요
그리고 Store에서 사진을 S3에 업로드하기 전 빈 문자열이면 S3에 올리지 않고 ""을 requestDTO에 담아 요청하도록 했습니다.

2️⃣ ProfilePhotoPicker 수정

컴포넌트 내부에 didDelete상태를 추가하였습니다.
왜냐면, 생각을 해보았는데, 기존에 프로필 사진이 있었던, 아니면 새로 골랐던 삭제를 누른 순간에는 무조건 기본 이미지가 떠야 하니까요

ProfilePhotoPicker.swift

if didDelete { // 사용자가 사진을 삭제했으면
    defaultProfileImage // 기본 이미지

} else if let selectedImage { // 사용자가 사진을 골랐다면
    Image(uiImage: selectedImage) // 새 이미지 
        .resizable()
        .aspectRatio(contentMode: .fill)
        .frame(width: width, height: height)
        .background(.gray800)
        .circleClipped()
    
} else if let profileImageUrl { // 기존 프로필 이미지가 존재한다면
    KFImage(URL(string: profileImageUrl)) // 기존 이미지
        .resizable()
        .aspectRatio(contentMode: .fill)
        .frame(width: width, height: height)
        .circleClipped()
    
} else {
    defaultProfileImage
}

그래서 기존에 있던 if문에 didDelete를 제일 먼저 확인하여
사용자가 프로필 사진을 삭제했을 때 컴포넌트에서 기본 이미지가 뜨도록 구현했어요

// ProfilePhotoPicker.swift

Button {
    if didDelete { // 사용자가 사진을 삭제했으면 (무조건 기본 이미지가 떠있는 상태)
        requestPhotoAuthorization() // picker 바로 띄움

    } else if let _ = profileImageUrl { // 기존 이미지가 있으면
        isDialogPresented = true // 사진을 삭제 & 편집 선택 alert 띄움

    } else if let _ = selectedImage { // 사용자가 선택한 이미지가 있으면
        isDialogPresented = true // 사진을 삭제 & 편집 선택 alert 띄움

    } else {
        requestPhotoAuthorization()
    }

추가적으로 프로필 사진을 눌렀을 때 수정할 건지, 삭제할 건지도 사용자에게 물어봐야하기 때문에

  • 기본이미지가 떠있으면 => 무조건 새로운 이미지 선택
  • 선택한 이미지 & 기존프로필이미지가 떠있으면 => 삭제 & 편집 선택 alert 표시
    이렇게 구현했습니다.
    (아 아직 저 alert는 디잔쌤들한테 안 물어보긴 했어요.. qa때 물어보겠습니다)

🔗 연결된 이슈

👀 기타 더 이야기해볼 점

  • 백현씨 제가 많이 응원합니다. 파이팅. 아자스

@SeungWon1125 SeungWon1125 requested a review from a team November 18, 2025 17:35
@SeungWon1125 SeungWon1125 self-assigned this Nov 18, 2025
@SeungWon1125 SeungWon1125 added 🦒 seungwon 승원이가함! 🛠️ feat 새로운 기능 구현 시 사용 labels Nov 18, 2025
@SeungWon1125 SeungWon1125 linked an issue Nov 18, 2025 that may be closed by this pull request
1 task
Copy link
Copy Markdown
Contributor

@dudwntjs dudwntjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

충돌도 해결하신거조 짱입니더 아빠짱짱


func shouldSkipAuth(for path: String) -> Bool {
skipAuthKeywords.contains { path.contains($0) }
skipAuthKeywords.contains { path.hasPrefix($0) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasPrefix옹 요런게 잇군요!!


MyPageSettings(
loginProvider: "카카오 로그인",
loginProvider: store.state.loginInformation,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옹 이거 지우셧군요

row(title: "고객센터", action: onTapCustomerCenter)

row(title: "로그인 정보", trailing: loginProvider)
row(title: "로그인 정보", trailing: loginProvider?.loginInformation ?? "")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?? 근데 이거 머라고 읽어요

닐 코얼레ㅔ싱?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스크린샷 2025-11-19 12 57 46

옛날에 과제 보니까 그렇다고 하네요. 또 까먹었음

@SeungWon1125 SeungWon1125 merged commit 3de0395 into develop Nov 19, 2025
@SeungWon1125 SeungWon1125 deleted the feat/#337-login-info-api branch November 19, 2025 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ feat 새로운 기능 구현 시 사용 🦒 seungwon 승원이가함!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 사용자 로그인 정보 API 연동

2 participants