-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#152 버그 수정
- Loading branch information
Showing
27 changed files
with
325 additions
and
210 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
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
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
63 changes: 63 additions & 0 deletions
63
Mongle/Mongle/Resource/APIService/PasswordChangeService.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,63 @@ | ||
// | ||
// PasswordChangeService.swift | ||
// Mongle | ||
// | ||
// Created by 이예슬 on 11/19/20. | ||
// Copyright © 2020 이주혁. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Alamofire | ||
struct PasswordChangeService{ | ||
static let shared = PasswordChangeService() | ||
|
||
private func makeParameter(_ password : String)-> Parameters{ | ||
return ["password" : password] | ||
} | ||
|
||
func putRequest(password:String, completion : @escaping (NetworkResult<Any>) -> Void){ | ||
let header : HTTPHeaders = ["Content-Type" : "application/json", "token" : UserDefaults.standard.string(forKey: "token")!] | ||
|
||
let dataRequest = Alamofire.request(APIConstants.passwordChangeURL, | ||
method: .put, | ||
parameters: makeParameter(password), | ||
encoding: JSONEncoding.default, | ||
headers: header) | ||
|
||
|
||
dataRequest.responseData { dataResponse in | ||
switch dataResponse.result { | ||
case .success : | ||
guard let statusCode = dataResponse.response?.statusCode else {return} | ||
guard let data = dataResponse.value else {return} | ||
let networkResult = self.judgePut(by: statusCode, data) | ||
completion(networkResult) | ||
|
||
case .failure : | ||
|
||
completion(.networkFail) | ||
|
||
|
||
} | ||
} | ||
} | ||
private func judgePut( by statusCode:Int, _ data :Data) -> NetworkResult<Any> { | ||
let decoder = JSONDecoder() | ||
|
||
guard let decodedData = try? decoder.decode(GenericResponse<String>.self, from: data) | ||
else { return .pathErr } | ||
|
||
switch statusCode{ | ||
case 200 : | ||
return .success(decodedData.message) | ||
case 400_: | ||
return .requestErr(decodedData.message) | ||
case 600 : | ||
return .serverErr | ||
default : | ||
return .networkFail | ||
} | ||
|
||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/searchResultThemeBtnBack.imageset/Contents.json
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,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x", | ||
"filename" : "searchResultThemeBtnBack.png" | ||
}, | ||
{ | ||
"scale" : "2x", | ||
"idiom" : "universal", | ||
"filename" : "[email protected]" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x", | ||
"filename" : "[email protected]" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+315 Bytes
.../Assets.xcassets/searchResultThemeBtnBack.imageset/searchResultThemeBtnBack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+450 Bytes
...sets.xcassets/searchResultThemeBtnBack.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+691 Bytes
...sets.xcassets/searchResultThemeBtnBack.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.