Apollo client is now accesible

This commit is contained in:
Johannes Schmelz 2022-01-11 18:25:00 +01:00
parent 6d99fab472
commit 71c1611e3e
2 changed files with 4 additions and 7 deletions

View File

@ -1,10 +1,6 @@
package org.dnss.sfs.git.wdg.noise package org.dnss.sfs.git.wdg.noise
import com.apollographql.apollo3.ApolloClient import com.apollographql.apollo3.ApolloClient
class Apollo {
val apolloClient = ApolloClient.Builder() val apolloClient = ApolloClient.Builder()
.serverUrl("https://noise.sfs.ddnss.org/graphql") .serverUrl("https://noise.sfs.ddnss.org/graphql")
.build() .build()
}

View File

@ -8,7 +8,8 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import org.dnss.sfs.git.wdg.noise.Apollo import org.ddnss.sfs.git.wdg.noise.GetUsersQuery
import org.dnss.sfs.git.wdg.noise.apolloClient
import org.dnss.sfs.git.wdg.noise.databinding.FragmentGalleryBinding import org.dnss.sfs.git.wdg.noise.databinding.FragmentGalleryBinding
class GalleryFragment : Fragment() { class GalleryFragment : Fragment() {
@ -38,9 +39,9 @@ class GalleryFragment : Fragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
lifecycleScope.launchWhenResumed { lifecycleScope.launchWhenResumed {
val response = Apollo.apolloClient.query(getUsers()).execute() val response = apolloClient.query(GetUsersQuery()).execute()
Log.d("getUsers", "Data:: ${response.data}")
} }
} }