Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.storybook
- import com.example.storybook.models.RequestRegister
- import com.example.storybook.models.ResponseRegister
- import com.example.storybook.utils.toMap
- import dev.abd3lraouf.libs.pocketbase.kotlin.PocketbaseClient
- import io.ktor.http.URLProtocol
- object NetworkClient {
- val client = PocketbaseClient(
- baseUrl = {
- protocol = URLProtocol.HTTP
- host = "192.168.0.196"
- port = 8090
- }
- )
- suspend fun register(email: String, password: String, passwordConfirm: String) {
- val response = client.records.create<ResponseRegister>(
- sub = "collections/users/records",
- body = RequestRegister(
- email,
- password,
- passwordConfirm
- ).toMap(),
- files = emptyList()
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment