본인인증 완료
- 남성이면 남성향, 여성이면 여성향으로 콘텐츠 보기 설정이 변경되도록 수정
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 {
|
do {
|
||||||
let jsonDecoder = JSONDecoder()
|
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 {
|
if let data = decoded.data, decoded.success {
|
||||||
self.errorMessage = "본인인증이 완료되었습니다."
|
if data.gender == 0 {
|
||||||
self.isShowPopup = true
|
UserDefaults.set(ContentType.FEMALE.rawValue, forKey: .contentPreference)
|
||||||
self.getMypage()
|
} else {
|
||||||
|
UserDefaults.set(ContentType.MALE.rawValue, forKey: .contentPreference)
|
||||||
|
}
|
||||||
|
AppState.shared.isChangeAdultContentVisible = true
|
||||||
|
AppState.shared.setAppStep(step: .splash)
|
||||||
} else {
|
} else {
|
||||||
if let message = decoded.message {
|
if let message = decoded.message {
|
||||||
self.errorMessage = message
|
self.errorMessage = message
|
||||||
|
Reference in New Issue
Block a user