Adds club to collection

multistore
Laurent 1 year ago
parent 0b2542bc29
commit 08c466e45f
  1. 3
      PadelClub/Views/Club/CreateClubView.swift

@ -50,12 +50,13 @@ struct CreateClubView: View {
//update existing club if rights ok / freshly created club with data input from user //update existing club if rights ok / freshly created club with data input from user
if existingOrCreatedClub.hasBeenCreated(by: dataStore.user.id) { if existingOrCreatedClub.hasBeenCreated(by: dataStore.user.id) {
existingOrCreatedClub.update(fromClub: club) existingOrCreatedClub.update(fromClub: club)
}
do { do {
try dataStore.clubs.addOrUpdate(instance: existingOrCreatedClub) try dataStore.clubs.addOrUpdate(instance: existingOrCreatedClub)
} catch { } catch {
Logger.error(error) Logger.error(error)
} }
}
//save into user //save into user
if dataStore.user.clubs.contains(where: { $0 == existingOrCreatedClub.id }) == false { if dataStore.user.clubs.contains(where: { $0 == existingOrCreatedClub.id }) == false {

Loading…
Cancel
Save