Skip to content

Commit

Permalink
[Fix/#54] 중복 로그인 안되던 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-seonwoo committed Jun 18, 2024
1 parent 4e6308a commit 6077690
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions HMH_iOS/HMH_iOS/Network/Foundation/APIConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,52 @@
import Foundation
import Moya

struct APIConstants{
struct APIConstants {
static let contentType = "Content-Type"
static let applicationJSON = "application/json"
static let auth = "Authorization"
// 아래 주석은 네트워크 연결할 때 해제해주세요!

static var accessToken: String {
let socialToken = "Bearer " + UserManager.shared.accessToken
return socialToken
return "Bearer " + (UserManager.shared.accessToken ?? "")
}

static var refreshToken: String {
let socialToken = "Bearer " + UserManager.shared.refreshToken
return socialToken
return "Bearer " + (UserManager.shared.refreshToken ?? "")
}

static var appleAccessToken: String {
let socialToken = UserManager.shared.socialToken
return socialToken
return UserManager.shared.socialToken ?? ""
}

static let OS = "OS"
static let iOS = "iOS"
}

extension APIConstants{
static let hasSocialTokenHeader = [contentType: applicationJSON,
auth : appleAccessToken]
static let hasTokenHeader = [contentType: applicationJSON,
OS: iOS,
auth : accessToken]
static let hasAccessTokenHeader = [contentType: applicationJSON,
auth : accessToken]
static let hasRefreshTokenHeader = [contentType: applicationJSON,
auth : refreshToken]
static let signUpHeader = [contentType: applicationJSON,
auth : appleAccessToken,
OS: iOS,]
extension APIConstants {
static var hasSocialTokenHeader: [String: String] {
return [contentType: applicationJSON,
auth: appleAccessToken]
}

static var hasTokenHeader: [String: String] {
return [contentType: applicationJSON,
OS: iOS,
auth: accessToken]
}

static var hasAccessTokenHeader: [String: String] {
return [contentType: applicationJSON,
auth: accessToken]
}

static var hasRefreshTokenHeader: [String: String] {
return [contentType: applicationJSON,
auth: refreshToken]
}

static var signUpHeader: [String: String] {
return [contentType: applicationJSON,
auth: appleAccessToken,
OS: iOS]
}
}

0 comments on commit 6077690

Please sign in to comment.