레디스 JWT 토큰 저장소 - tokenList 가 계속 null 이 되면서 초기화가 되지 않아 set 으로 변경하고 default value 를 이용한 초기화로 변경

This commit is contained in:
2023-08-08 12:47:49 +09:00
parent f7cdf40976
commit 771dbeced0
3 changed files with 5 additions and 9 deletions

View File

@@ -371,9 +371,7 @@ class MemberService(
val memberToken = tokenRepository.findByIdOrNull(memberId)
?: throw SodaException("로그인 정보를 확인해주세요.")
val memberTokenSet = memberToken.tokenList.toMutableSet()
memberTokenSet.remove(token)
memberToken.tokenList = memberTokenSet.toMutableList()
memberToken.tokenSet.remove(token)
tokenRepository.save(memberToken)
}
}

View File

@@ -7,5 +7,5 @@ import org.springframework.data.redis.core.RedisHash
data class MemberToken(
@Id
val id: Long,
var tokenList: MutableList<String>
var tokenSet: MutableSet<String> = mutableSetOf()
)