Skip to content

Commit

Permalink
Merge branch 'feat/#25-mypage' of https://github.com/OnAndOff-UMC/iOS
Browse files Browse the repository at this point in the history
…into feat/#25-mypage
  • Loading branch information
dami0806 committed Feb 18, 2024
2 parents a874019 + 8305640 commit 4809d35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions On_off_iOS/On_off_iOS/Home/Base/View/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ final class HomeViewController: UIViewController {
bindFutureRelay(output: output)
bindClickImagePlusButton()
bindClickImageButton()
bindAddWorkLifeBalanceFeedButton()
bindAddWorkLifeBalanceFeedButton(output: output)
bindSelectedFeedTableViewCell()
bindCheckToday(output: output)
bindMoveInquireMemoirsViewController()
Expand Down Expand Up @@ -460,11 +460,14 @@ final class HomeViewController: UIViewController {
}

/// 워라벨 피드 추가 버튼
private func bindAddWorkLifeBalanceFeedButton() {
private func bindAddWorkLifeBalanceFeedButton(output: HomeViewModel.Output) {
offUIView.clickedAddfeedButton
.bind { [weak self] in
guard let self = self else { return }
presentInsertWLBFeedView(insertFeed: nil)
presentInsertWLBFeedView(insertFeed: Feed(feedId: nil,
isChecked: nil,
date: output.dayListRelay.value[output.selectedDayIndex.value.row].totalDate,
content: nil))
}
.disposed(by: disposeBag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ final class InsertWorkLifeBalanceFeedService {
func addFeed(feed: AddFeed) -> Observable<Bool> {
let url = Domain.RESTAPI + FeedPath.workLifeBalacne.rawValue
let header = Header.header.getHeader()
print(url)
print(url, feed)

return Observable.create { observer in
AF.request(url,
method: .post,
Expand All @@ -27,6 +27,7 @@ final class InsertWorkLifeBalanceFeedService {
headers: header)
.validate(statusCode: 200..<201)
.responseDecodable(of: Response<Feed>.self) { response in

print(#function, response)
switch response.result {
case .success(let data):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ final class InsertWorkLifeBalanceFeedViewModel {

/// Add Feed To Backend Server
private func addFeed(output: Output) {
let feed: AddFeed = AddFeed(date: formatDate(date: Date()),
let feed: AddFeed = AddFeed(date: output.insertRelay.value?.date ?? "",
content: output.textRelay.value)
print(feed)
service.addFeed(feed: feed)
Expand Down

0 comments on commit 4809d35

Please sign in to comment.