diff --git a/Sources/ViewModel/MyPage/MyPageViewModel.swift b/Sources/ViewModel/MyPage/MyPageViewModel.swift index 1ffebd7..b2c0122 100644 --- a/Sources/ViewModel/MyPage/MyPageViewModel.swift +++ b/Sources/ViewModel/MyPage/MyPageViewModel.swift @@ -9,7 +9,6 @@ import Foundation import RxSwift import RxCocoa -import KeychainSwift class MyPageViewModel: ViewModel { @@ -17,22 +16,25 @@ class MyPageViewModel: ViewModel { let output = Output() struct Input { - let logOutButtonIsTapped: Driver - let notificationSwitchIsOn: Driver + var confirmButtonIsTapped: Driver } struct Output { - var logOutResult = PublishRelay() + var changePasswordResult = PublishRelay() } func transform(_ input: Input) -> Output { - input.logOutButtonIsTapped.asObservable() - .subscribe( - onNext: { - KeychainSwift().delete("ACCESS-TOKEN") - } - ).disposed(by: disposeBag) - + input.confirmButtonIsTapped.asObservable().subscribe(onNext: { pwd in + HTTPClient.shared.networking( + api: .updatePassword(pwd), + model: EmptyModel.self + ).subscribe(onSuccess: { _ in + self.output.changePasswordResult.accept(true) + }, onFailure: { error in + print(error) + self.output.changePasswordResult.accept(false) + }).disposed(by: self.disposeBag) + }).disposed(by: disposeBag) return output } }