Skip to content

Commit

Permalink
Merge pull request #145 from Team-Ampersand/feature/141_gauth_login_r…
Browse files Browse the repository at this point in the history
…emote_logic

🔀 :: (#141) gauth login remote logic
  • Loading branch information
yeongun130 authored Nov 27, 2023
2 parents 6256534 + c451f53 commit 2c49620
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/src/main/java/com/msg/dotori/module/NetworkModule.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.msg.dotori.module

import android.util.Log
import com.msg.dotori.BuildConfig
import com.msg.data.remote.network.AuthApi
import com.msg.data.remote.network.GAuthApi
import com.msg.data.remote.network.MassageApi
import com.msg.data.remote.network.MusicApi
import com.msg.data.remote.network.NoticeApi
import com.msg.data.remote.network.RuleViolationApi
import com.msg.data.remote.network.SelfStudyApi
import com.msg.data.remote.network.StudentInfoApi
import com.msg.data.remote.util.AuthInterceptor
import com.msg.dotori.BuildConfig
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -18,7 +19,6 @@ import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.create
import java.util.concurrent.TimeUnit
import javax.inject.Singleton

Expand Down Expand Up @@ -54,7 +54,7 @@ object NetworkModule {
gsonConverterFactory: GsonConverterFactory
): Retrofit {
return Retrofit.Builder()
.baseUrl(BuildConfig.DEVELOP_URL)
.baseUrl(BuildConfig.RELEASE_URL)
.client(okHttpClient)
.addConverterFactory(gsonConverterFactory)
.build()
Expand All @@ -66,6 +66,12 @@ object NetworkModule {
return GsonConverterFactory.create()
}

@Provides
@Singleton
fun provideGAuthApi(retrofit: Retrofit): GAuthApi {
return retrofit.create(GAuthApi::class.java)
}

@Provides
@Singleton
fun provideAuthApi(retrofit: Retrofit): AuthApi = retrofit.create(AuthApi::class.java)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.msg.data.remote.dto.auth

data class GAuthLoginRequest(
val code: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.msg.data.remote.dto.auth

data class GAuthLoginResponse(
val accessToken: String,
val refreshToken: String,
val accessTokenExp: String,
val refreshTokenExp: String
)
13 changes: 13 additions & 0 deletions data/src/main/java/com/msg/data/remote/network/GAuthApi.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.msg.data.remote.network

import com.msg.data.remote.dto.auth.GAuthLoginRequest
import com.msg.data.remote.dto.auth.GAuthLoginResponse
import retrofit2.http.Body
import retrofit2.http.POST

interface GAuthApi {
@POST("auth")
suspend fun gAuthLogin(
@Body body: GAuthLoginRequest
): GAuthLoginResponse
}

0 comments on commit 2c49620

Please sign in to comment.