forked from AcaMate/AcaMate_iOS
62 lines
1.9 KiB
Swift
62 lines
1.9 KiB
Swift
//
|
|
// SelectAcademyView.swift
|
|
// AcaMate
|
|
//
|
|
// Created by TAnine on 2/18/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Combine
|
|
|
|
|
|
struct SelectAcademyView: View {
|
|
@State var cancellables: Set<AnyCancellable> = []
|
|
var bids: [String]
|
|
@State private var academyCode: String = ""
|
|
|
|
var body: some View {
|
|
VStack(spacing: 0) {
|
|
Spacer()
|
|
.frame(height: 100)
|
|
Image(.Logo.appIcon)
|
|
.resizable()
|
|
.frame(width: 200, height: 200)
|
|
CustomTextField(placeholder: "학원 코드 입력", text: $academyCode)
|
|
.frame(maxWidth: .infinity,maxHeight: 48)
|
|
.padding(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20))
|
|
.background {
|
|
RoundedRectangle(cornerRadius: 24)
|
|
.foregroundStyle(Color(.Normal.light))
|
|
}
|
|
// .padding([.leading, .trailing], 24)
|
|
.padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 24))
|
|
|
|
}
|
|
.onAppear {
|
|
loadAPIData(url: "\(API_URL)",
|
|
path: "/api/v1/in/member/academy",
|
|
method: .post,
|
|
parameters: ["bids": bids],
|
|
decodingType: APIResponse<[AcademyName]>.self)
|
|
.sink { completion in
|
|
|
|
switch completion {
|
|
case .failure(let error):
|
|
printLog("\(error)")
|
|
// appVM.isLoading.toggle()
|
|
case .finished:
|
|
break
|
|
// appVM.isLoading.toggle()
|
|
}
|
|
} receiveValue: { response in
|
|
guard let ua = response as? APIResponse<[AcademyName]> else {return}
|
|
printLog(ua)
|
|
}
|
|
.store(in: &cancellables)
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|