Skip to content

Commit

Permalink
♻️ :: api 키 값에 맞춰서 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Cjsghkd committed Sep 18, 2023
1 parent 71a4cdc commit 27c376e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface LocalDataSource {
expiresAt: String
)

suspend fun saveRole(role: String)
suspend fun saveRole(roles: String)

fun getAccessToken(): Flow<String>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LocalDataSourceImpl @Inject constructor(
private val ACCESS_TOKEN = stringPreferencesKey("access_token")
private val REFRESH_TOKEN = stringPreferencesKey("refresh_token")
private val EXPIRES_AT = stringPreferencesKey("expires_at")
private val ROLE = stringPreferencesKey("role")
private val ROLE = stringPreferencesKey("roles")
}

override suspend fun saveToken(accessToken: String, refreshToken: String, expiresAt: String) {
Expand All @@ -31,9 +31,9 @@ class LocalDataSourceImpl @Inject constructor(
}
}

override suspend fun saveRole(role: String) {
override suspend fun saveRole(roles: String) {
context.dataStore.edit {
it[ROLE] = role
it[ROLE] = roles
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class AuthInterceptor @Inject constructor(
val token = JsonParser.parseString(response.body!!.string()) as JsonObject
runBlocking {
localDataSource.saveToken(
accessToken = token["access_token"].asString,
refreshToken = token["refresh_token"].asString,
expiresAt = token["expires_at"].asString
accessToken = token["accessToken"].asString,
refreshToken = token["refreshToken"].asString,
expiresAt = token["expiresAt"].asString
)
localDataSource.saveRole(token["role"].asString)
localDataSource.saveRole(token["roles"].asString)
}
} else throw TokenExpiredException()
}
Expand Down

0 comments on commit 27c376e

Please sign in to comment.