Skip to content

Conversation

@kjinju0504-cloud
Copy link
Contributor

📌 PR 제목

9주차 미션 완료

✅ 변경 사항

이번 PR에서 변경된 내용을 간략히 정리해주세요.

  • 기능1
  • Network 모듈 만들기
  • 기능 2
  • [SignUpActivity] 회원가입 API 연동하기 / 오류처리
  • 기능 3
  • [LoginActivity] 로그인 API 연동하기 / 오류 처리
  • 기능 4
  • [SignUpActivity] 닉네임 추가하기

📷 영상 및 스크린샷

KakaoTalk_20251127_180831693.mp4

작업 내용을 스크린샷 또는 영상 형태로 올려주세요.

🔗 알게 된 사항

워크북과 과제를 하며 알게 된 점을 작성해주세요

📝 질문 사항

워크북과 과제를 하며 궁금했던 점을 작성해주세요

@kjinju0504-cloud kjinju0504-cloud changed the title Kangpearl/#80 [Mission] 9주차 미션 제출 Nov 27, 2025
Copy link
Member

@yangjiae12 yangjiae12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

val spf = getSharedPreferences("auth", MODE_PRIVATE)
val jwt = spf.getString("jwt", "") // 저장된 토큰 가져오기

if (jwt == null || jwt.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기에 코틀린 확장 함수 써서 jwt.isNullOrEmpty()로 작성하시면 코드가 더 깔끔할 것 같습니다!


val authService = getRetrofit().create(AuthRetrofitInterface::class.java)

authService.test("Bearer $jwt").enqueue(object : Callback<AuthResponse<TestResult>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금은 authService.test("Bearer $jwt") 처럼 직접 문자열을 붙여서 보내고 있는데, 실제로는 Retrofit Interceptor(인터셉터) 라는 걸 써서 모든 요청에 자동으로 토큰을 끼워 넣게 됩니다! 참고하시면 좋을 거 같아요

import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

const val BASE_URL = "http://43.200.73.115:8080"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

작성하신 BASE_URL을 보니 IP 주소를 상수에 그대로 적으셨는데, 프로젝트를 할 때는 보통 저렇게 하지 않습니다. Git 같은 곳에 올릴 때 서버가 노출되면 보안상 좋지 않기 때문에 보통은 local.properties라는 파일에 숨겨두고, build.gradle을 통해 불러오는 방식을 씁니다! 나중에 한번 찾아보시면 좋을 것 같아요~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants