본인인증 완료
- 남성이면 남성향, 여성이면 여성향으로 콘텐츠 보기 설정이 변경되도록 수정
This commit is contained in:
		
							
								
								
									
										10
									
								
								SodaLive/Sources/MyPage/Auth/AuthResponse.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								SodaLive/Sources/MyPage/Auth/AuthResponse.swift
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| // | ||||
| //  AuthResponse.swift | ||||
| //  SodaLive | ||||
| // | ||||
| //  Created by klaus on 2/3/25. | ||||
| // | ||||
|  | ||||
| struct AuthResponse: Decodable { | ||||
|     let gender: Int | ||||
| } | ||||
| @@ -81,12 +81,16 @@ final class MyPageViewModel: ObservableObject { | ||||
|                      | ||||
|                     do { | ||||
|                         let jsonDecoder = JSONDecoder() | ||||
|                         let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData) | ||||
|                         let decoded = try jsonDecoder.decode(ApiResponse<AuthResponse>.self, from: responseData) | ||||
|                          | ||||
|                         if decoded.success { | ||||
|                             self.errorMessage = "본인인증이 완료되었습니다." | ||||
|                             self.isShowPopup = true | ||||
|                             self.getMypage() | ||||
|                         if let data = decoded.data, decoded.success { | ||||
|                             if data.gender == 0 { | ||||
|                                 UserDefaults.set(ContentType.FEMALE.rawValue, forKey: .contentPreference) | ||||
|                             } else { | ||||
|                                 UserDefaults.set(ContentType.MALE.rawValue, forKey: .contentPreference) | ||||
|                             } | ||||
|                             AppState.shared.isChangeAdultContentVisible = true | ||||
|                             AppState.shared.setAppStep(step: .splash) | ||||
|                         } else { | ||||
|                             if let message = decoded.message { | ||||
|                                 self.errorMessage = message | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung