You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
//
|
|
// AccountView.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Laurent Morvillier on 21/02/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
import LeStorage
|
|
|
|
struct AccountView: View {
|
|
|
|
var user: User
|
|
var handler: () -> ()
|
|
|
|
var body: some View {
|
|
Form {
|
|
#if DEBUG
|
|
if let purchase = Guard.main.currentBestPurchase, let item = StoreItem(rawValue: purchase.productId) {
|
|
PurchaseView(purchaseRow: PurchaseRow(id: purchase.id, name: purchase.productId, item: item))
|
|
}
|
|
#endif
|
|
Section {
|
|
NavigationLink("Changer de mot de passe") {
|
|
ChangePasswordView()
|
|
}
|
|
}
|
|
Section {
|
|
RowButtonView("Déconnexion", role: .destructive) {
|
|
DataStore.shared.disconnect()
|
|
handler()
|
|
}
|
|
}
|
|
Section {
|
|
RowButtonView("Supprimer mon compte", role: .destructive, confirmationMessage: "Voulez-vous vraiment supprimer définitivement votre compte et ses données associées ?") {
|
|
DataStore.shared.deleteAccount()
|
|
handler()
|
|
}
|
|
}
|
|
}.navigationTitle(user.username)
|
|
}
|
|
}
|
|
|
|
//#Preview {
|
|
// AccountView(user: User(username: "coco", email: ",mail", firstName: "first", lastName: "last", phone: "44444", country: "US")) {
|
|
//
|
|
// }
|
|
//}
|
|
|