마이페이지 추가

This commit is contained in:
Yu Sung
2023-08-10 16:14:12 +09:00
parent 80ff04f825
commit d06f4d6a36
40 changed files with 979 additions and 3 deletions

View File

@@ -0,0 +1,44 @@
//
// AuthApi.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import Foundation
import Moya
enum AuthApi {
case auth(request: AuthVerifyRequest)
}
extension AuthApi: TargetType {
var baseURL: URL {
return URL(string: BASE_URL)!
}
var path: String {
switch self {
case .auth:
return "/auth"
}
}
var method: Moya.Method {
return .post
}
var task: Task {
switch self {
case .auth(let request):
return .requestJSONEncodable(request)
}
}
var headers: [String : String]? {
switch self {
default:
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
}
}
}

View File

@@ -0,0 +1,27 @@
//
// AuthButtonView.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import SwiftUI
struct AuthButtonView: View {
var body: some View {
Text("본인인증")
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "eeeeee"))
.padding(.horizontal, 13.3)
.padding(.vertical, 20)
.frame(width: screenSize().width - 26.7, alignment: .leading)
.background(Color(hex: "664aab"))
.cornerRadius(6.7)
}
}
struct AuthButtonView_Previews: PreviewProvider {
static var previews: some View {
AuthButtonView()
}
}

View File

@@ -0,0 +1,20 @@
//
// AuthRepository.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import Foundation
import CombineMoya
import Combine
import Moya
final class AuthRepository {
private let api = MoyaProvider<AuthApi>()
func authCertificate(receiptId: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.auth(request: AuthVerifyRequest(receiptId: receiptId)))
}
}

View File

@@ -0,0 +1,16 @@
//
// AuthVerifyRequest.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import Foundation
struct AuthVerifyRequest: Encodable {
let receiptId: String
enum CodingKeys : String, CodingKey {
case receiptId = "receipt_id"
}
}