feat(eventCard): Add support for leaving invited events
This commit is contained in:
parent
d434a533bf
commit
48d24ac10a
|
@ -134,9 +134,14 @@ class DayViewActivity : AppCompatActivity() {
|
|||
* This can be triggered for invited events only, delete equivalent.
|
||||
*/
|
||||
private fun onEventLeave(event: EventResponse, position: Int) {
|
||||
TODO("API call for leaving event")
|
||||
events.removeAt(position)
|
||||
rvEvents.adapter!!.notifyItemRemoved(position)
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
RetrofitClient.eventsService.deleteInvitedEvent(event.id)
|
||||
}
|
||||
|
||||
events.removeAt(position)
|
||||
rvEvents.adapter!!.notifyItemRemoved(position)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,9 @@ interface EventsService {
|
|||
@DELETE("events/{event_id}")
|
||||
suspend fun deleteEvent(@Path("event_id") eventId: String): Unit
|
||||
|
||||
@DELETE("events/{event_id}/invited")
|
||||
suspend fun deleteInvitedEvent(@Path("event_id") eventId: String): Unit
|
||||
|
||||
@POST("events")
|
||||
suspend fun createEvent(@Body eventData: EventRequest): EventResponse
|
||||
|
||||
|
|
Loading…
Reference in a new issue