-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6fd8ef
commit 90af09b
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
HMH_iOS/HMH_iOS/Network/DTO/AuthModel/SocialLoginRequestDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// SocialLoginRequestDTO.swift | ||
// HMH_iOS | ||
// | ||
// Created by Seonwoo Kim on 1/14/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct SocialLoginRequestDTO: Codable { | ||
let socialPlatform: String | ||
} |
18 changes: 18 additions & 0 deletions
18
HMH_iOS/HMH_iOS/Network/DTO/AuthModel/SocialLoginResponseDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// SocialLoginResponseDTO.swift | ||
// HMH_iOS | ||
// | ||
// Created by Seonwoo Kim on 1/14/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct SocialLogineResponseDTO: Codable { | ||
let userId: Int | ||
let token: Token | ||
} | ||
|
||
struct Token: Codable { | ||
let accessToken: String | ||
let refreshToken: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// AuthRouter.swift | ||
// HMH_iOS | ||
// | ||
// Created by Seonwoo Kim on 1/14/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import Moya | ||
|
||
enum AuthRouter { | ||
case socialLogin(data: SocialLoginRequestDTO) | ||
} | ||
|
||
extension AuthRouter: BaseTargetType { | ||
var headers: [String : String]? { | ||
switch self { | ||
case .socialLogin: | ||
return APIConstants.hasSocialTokenHeader | ||
} | ||
} | ||
|
||
var path: String { | ||
switch self { | ||
case .socialLogin: | ||
return "user/login" | ||
} | ||
} | ||
|
||
var method: Moya.Method { | ||
switch self { | ||
case .socialLogin: | ||
return .post | ||
} | ||
} | ||
|
||
var task: Moya.Task { | ||
switch self { | ||
case .socialLogin(let data): | ||
return .requestJSONEncodable(data) | ||
} | ||
} | ||
} |