From e641636007bb685847a32f3b3bea4382654c1573 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 20 Feb 2025 03:16:13 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B3=B8=EC=9D=B8=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C=20-=20=EB=82=A8=EC=84=B1=EC=9D=B4=EB=A9=B4?= =?UTF-8?q?=20=EB=82=A8=EC=84=B1=ED=96=A5,=20=EC=97=AC=EC=84=B1=EC=9D=B4?= =?UTF-8?q?=EB=A9=B4=20=EC=97=AC=EC=84=B1=ED=96=A5=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=B3=B4=EA=B8=B0=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EC=9D=B4=20=EB=B3=80=EA=B2=BD=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/MyPage/Auth/AuthResponse.swift | 10 ++++++++++ SodaLive/Sources/MyPage/MyPageViewModel.swift | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 SodaLive/Sources/MyPage/Auth/AuthResponse.swift diff --git a/SodaLive/Sources/MyPage/Auth/AuthResponse.swift b/SodaLive/Sources/MyPage/Auth/AuthResponse.swift new file mode 100644 index 0000000..50b269c --- /dev/null +++ b/SodaLive/Sources/MyPage/Auth/AuthResponse.swift @@ -0,0 +1,10 @@ +// +// AuthResponse.swift +// SodaLive +// +// Created by klaus on 2/3/25. +// + +struct AuthResponse: Decodable { + let gender: Int +} diff --git a/SodaLive/Sources/MyPage/MyPageViewModel.swift b/SodaLive/Sources/MyPage/MyPageViewModel.swift index ca990ef..6ab3925 100644 --- a/SodaLive/Sources/MyPage/MyPageViewModel.swift +++ b/SodaLive/Sources/MyPage/MyPageViewModel.swift @@ -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.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