username8817

Untitled

Jan 17th, 2026
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.86 KB | None | 0 0
  1. package com.example.storybook
  2.  
  3. import com.example.storybook.models.RequestRegister
  4. import com.example.storybook.models.ResponseRegister
  5. import com.example.storybook.utils.toMap
  6. import dev.abd3lraouf.libs.pocketbase.kotlin.PocketbaseClient
  7. import io.ktor.http.URLProtocol
  8.  
  9. object NetworkClient {
  10.     val client = PocketbaseClient(
  11.         baseUrl = {
  12.             protocol = URLProtocol.HTTP
  13.             host = "192.168.0.196"
  14.             port = 8090
  15.         }
  16.     )
  17.  
  18.     suspend fun register(email: String, password: String, passwordConfirm: String) {
  19.         val response = client.records.create<ResponseRegister>(
  20.             sub = "collections/users/records",
  21.             body = RequestRegister(
  22.                 email,
  23.                 password,
  24.                 passwordConfirm
  25.             ).toMap(),
  26.             files = emptyList()
  27.         )
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment