feat: add Koin network module for growth recipe feature
This commit is contained in:
parent
fafc3c5854
commit
4e58b0394e
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.syaroful.agrilinkvocpro.growth_recipe_feature.di
|
||||||
|
|
||||||
|
import com.syaroful.agrilinkvocpro.growth_recipe_feature.data.network.GrowthRecipeService
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import org.koin.dsl.module
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
val networkModule = module {
|
||||||
|
single {
|
||||||
|
OkHttpClient.Builder()
|
||||||
|
.connectTimeout(2, TimeUnit.SECONDS)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
single {
|
||||||
|
Retrofit.Builder()
|
||||||
|
.baseUrl("http://labai.polinema.ac.id:3042/")
|
||||||
|
.client(get())
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
single<GrowthRecipeService> { get<Retrofit>().create(GrowthRecipeService::class.java) }
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user