feat(eventCard): Add support for leaving invited events

This commit is contained in:
Peter Vacho 2025-01-02 15:07:46 +01:00
parent d434a533bf
commit 48d24ac10a
Signed by: school
GPG key ID: 8CFC3837052871B4
2 changed files with 11 additions and 3 deletions

View file

@ -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)
}
}
/**

View file

@ -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