package Ġid . co . wo i app . ui . join book Ċ Ċ import Ġandroidx . h ilt . lifecycle . ViewModel Inject Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġid . co . wo i app . data . entities . Book Ċ import Ġid . co . wo i app . data . repository . Join book Repository Ċ import Ġid . co . wo i app . utils . Resource Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠJoin book ViewModel Ġ@ ViewModel Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġrepository : ĠJoin book Repository Ċ ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġ_ response Ġ= ĠMutable LiveData < Resource < List < Book >> >() ĊĠĠĠ Ġval Ġresponse Ġ: ĠLive Data < Resource < List < Book >>> Ġ= Ġ_ response ĊĊĠĠĠ Ġfun Ġjoin book ( body : ĠBook ){ ĊĠĠĠĠĠĠĠ Ġ_ response . value Ġ= ĠResource . loading () ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ_ response . value Ġ= Ġrepository . join book ( body ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }