Skip to content

Commit

Permalink
[Feat] sopt-makers#161 - 유저 삭제 API 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
elesahich committed Apr 17, 2023
1 parent 1a73047 commit ab24319
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension SettingRepository: SettingRepositoryInterface {
}

public func withdrawal() -> AnyPublisher<Bool, Never> {
return authService.withdrawal()
return userService.withdraw()
.handleEvents(receiveOutput: { status in
if status == 200 {
UserDefaultKeyList.Auth.appAccessToken = nil
Expand Down
5 changes: 5 additions & 0 deletions SOPT-iOS/Projects/Modules/Network/Sources/API/UserAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum UserAPI {
case editSentence(sentence: String)
case getNicknameAvailable(nickname: String)
case changeNickname(nickname: String)
case withdrawal
}

extension UserAPI: BaseAPI {
Expand All @@ -33,6 +34,8 @@ extension UserAPI: BaseAPI {
return "nickname"
case .getNicknameAvailable(let nickname):
return "nickname/\(nickname)"
case .withdrawal:
return ""
}
}

Expand All @@ -43,6 +46,8 @@ extension UserAPI: BaseAPI {
return .get
case .editSentence, .changeNickname:
return .patch
case .withdrawal:
return .delete
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public protocol UserService {
func editSentence(sentence: String) -> AnyPublisher<EditSentenceEntity, Error>
func getNicknameAvailable(nickname: String) -> AnyPublisher<Int, Error>
func changeNickname(nickname: String) -> AnyPublisher<Int, Error>
func withdraw() -> AnyPublisher<Int, Error>
}

extension DefaultUserService: UserService {
Expand All @@ -39,4 +40,8 @@ extension DefaultUserService: UserService {
public func changeNickname(nickname: String) -> AnyPublisher<Int, Error> {
requestObjectInCombineNoResult(.changeNickname(nickname: nickname))
}

public func withdraw() -> AnyPublisher<Int, Error> {
requestObjectInCombineNoResult(.withdrawal)
}
}

0 comments on commit ab24319

Please sign in to comment.