Skip to content

Commit

Permalink
[CHORE] Add fcmToken in auth model
Browse files Browse the repository at this point in the history
로그인(회원가입) 요청 모델에 fcmToken을 추가로 처리
  • Loading branch information
WhiteHyun committed Apr 10, 2023
1 parent 4e5f075 commit 231f228
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions PLUB/Sources/Models/Auth/Request/SignInRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import Foundation
/// 소셜 로그인 요청 모델
struct SignInRequest: Codable {

/// Firebase Cloud Messaging Token
let fcmToken: String

/// 액세스 토큰(카카오, 애플)
/// 애플의 경우 identityToken을 해당 값으로 처리해야합니다.
let accessToken: String?
Expand Down
6 changes: 6 additions & 0 deletions PLUB/Sources/Models/Auth/Request/SignUpRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import Then

/// 회원가입 요청 모델
struct SignUpRequest: Codable {

/// Firebase Cloud Messaging Token
let fcmToken: String

/// sign token
var signToken: String

Expand Down Expand Up @@ -48,6 +52,7 @@ struct SignUpRequest: Codable {
var marketing: Bool

init() {
fcmToken = UserManager.shared.fcmToken!
signToken = UserManager.shared.signToken!
categoryList = []
birthday = ""
Expand All @@ -66,6 +71,7 @@ struct SignUpRequest: Codable {

extension SignUpRequest {
enum CodingKeys: String, CodingKey {
case fcmToken
case signToken
case categoryList
case profileImageLink = "profileImage"
Expand Down
9 changes: 8 additions & 1 deletion PLUB/Sources/Network/Services/AuthService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ extension AuthService {
authorizationCode: String?
) -> PLUBResult<SignInResponse> {
return sendRequest(
AuthRouter.socialLogin(SignInRequest(accessToken: token, authorizationCode: authorizationCode, socialType: socialType)),
AuthRouter.socialLogin(
SignInRequest(
fcmToken: UserManager.shared.fcmToken!,
accessToken: token,
authorizationCode: authorizationCode,
socialType: socialType
)
),
type: SignInResponse.self
)
}
Expand Down

0 comments on commit 231f228

Please sign in to comment.