Skip to content

Commit

Permalink
[FEAT] #235 로그인 서버 통신 코드 변경, 프로필 수정 플레이스홀더 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
comeheredart committed Jun 26, 2022
1 parent b74aee9 commit 4e50d83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
7 changes: 2 additions & 5 deletions ChaRo-iOS/ChaRo-iOS/Source/Services/SocialLoginService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,11 @@ struct SocialLoginService {
else {
return .pathErr
}

print(decodedData)
print(statusCode)


switch statusCode {

case 200, 401, 404:
return .success(decodedData.success)
return .success(decodedData.data)

case 400...499:
print(decodedData.msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ChangeImageVC: UIViewController {

private let nicknameView = JoinInputView(title: "",
subTitle: "닉네임",
placeholder: "기존 닉네임").then {
placeholder: "\(UserDefaults.standard.object(forKey: Constants.UserDefaultsKey.userNickname) as? String ?? "")").then {
$0.inputTextField?.text = UserDefaults.standard.object(forKey: Constants.UserDefaultsKey.userNickname) as? String
}

Expand Down
26 changes: 12 additions & 14 deletions ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/SignScene/SNSLoginVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,18 @@ class SNSLoginVC: UIViewController {
SocialLoginService.shared.socialLogin(email: email) { (response) in

switch(response) {
case .success(let success):
if let success = success as? Bool {
if success {
print("로그인 성공")
//여기서 UserDefault 에 저장
Constants.addUserDefaults(userEmail: email,
userPassword: "",
userNickname: nickname ?? "",
userImage: profileImage ?? "")
self.goToHomeVC()
} else {
print("회원가입 갈겨")
self.snsJoin(email: email, profileImage: profileImage, nickname: nickname)
}
case .success(let data):
if let data = data as? UserData {
print("로그인 성공")
//여기서 UserDefault 에 저장
Constants.addUserDefaults(userEmail: data.email,
userPassword: "",
userNickname: data.nickname ?? "",
userImage: data.profileImage ?? "")
self.goToHomeVC()
} else {
print("회원가입 갈겨")
self.snsJoin(email: email, profileImage: profileImage, nickname: nickname)
}
case .requestErr(let message) :
print("requestERR", message)
Expand Down

0 comments on commit 4e50d83

Please sign in to comment.