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