SPARK-1127
This commit is contained in:
1 parent
1bd2b4c601
commit
a2403c643d
4 files changed
+26
-18
No files matched your search
@@ -66,12 +66,17 @@ let createAccount (admin:IAdminService) (account:BTSAccount) = promise {
|
||||
}
|
||||
|
||||
let deleteAccount (admin:IAdminService) (account:BTSAccount) = promise {
|
||||
let! result = admin.delete_account { id = account.id }
|
||||
if result.isSuccess then
|
||||
let! data = admin.get_admin_data()
|
||||
return UpdateAdminData data
|
||||
else
|
||||
return ErrorOccured (sprintf "Error deleting account: %s" result.errorText)
|
||||
match Fable.Import.Browser.window.confirm "Are you sure?" with
|
||||
| false ->
|
||||
let! data = admin.get_admin_data()
|
||||
return UpdateAdminData data
|
||||
| true ->
|
||||
let! result = admin.delete_account { id = account.id }
|
||||
if result.isSuccess then
|
||||
let! data = admin.get_admin_data()
|
||||
return UpdateAdminData data
|
||||
else
|
||||
return ErrorOccured (sprintf "Error deleting account: %s" result.errorText)
|
||||
}
|
||||
|
||||
let erase (arr:'a[]) i =
|
||||
|
||||
@@ -60,8 +60,7 @@ let generalView model dispatch =
|
||||
let removefn,removeEnabled =
|
||||
match model.scratch with
|
||||
| account when isNewAccount account -> ignore,Disabled
|
||||
| account when account.isActive -> ignore,Disabled
|
||||
| account when not account.isActive ->
|
||||
| account ->
|
||||
(fun _ -> dispatch <| DeleteAccount account), Enabled
|
||||
|
||||
let account = model.scratch
|
||||
|
||||
@@ -116,12 +116,17 @@ let saveUser (admin:IAdminService) (user:BTSUser) = promise {
|
||||
}
|
||||
|
||||
let deleteUser (admin:IAdminService) (user:BTSUser) = promise {
|
||||
let! result = admin.delete_user { id = user.id }
|
||||
if (result.isSuccess) then
|
||||
let! data = admin.get_admin_data()
|
||||
return UpdateAdminData data
|
||||
else
|
||||
return ErrorOccured (sprintf "Error deleting user: %s" result.errorText)
|
||||
match Fable.Import.Browser.window.confirm "Are you sure?" with
|
||||
| false ->
|
||||
let! data = admin.get_admin_data()
|
||||
return UpdateAdminData data
|
||||
| true ->
|
||||
let! result = admin.delete_user { id = user.id }
|
||||
if (result.isSuccess) then
|
||||
let! data = admin.get_admin_data()
|
||||
return UpdateAdminData data
|
||||
else
|
||||
return ErrorOccured (sprintf "Error deleting user: %s" result.errorText)
|
||||
}
|
||||
|
||||
let createUser (admin:IAdminService) (user:BTSUser) = promise {
|
||||
|
||||
@@ -34,10 +34,9 @@ let saveButton (model:Users.Types.Model) dispatch =
|
||||
|
||||
let generalTabContent (model:Model) (dispatch:Msg->Unit) =
|
||||
let removefn, removeEnabled =
|
||||
match (model.scratchUser.id > 0), model.scratchUser.isActive with
|
||||
| false, true -> ignore, Button.Disabled
|
||||
| true, true -> ignore, Button.Disabled
|
||||
| true, false ->
|
||||
match (model.scratchUser.id > 0)with
|
||||
| false -> ignore, Button.Disabled
|
||||
| true ->
|
||||
(fun _ -> dispatch <| Delete model.scratchUser), Button.Enabled
|
||||
div []
|
||||
[
|
||||
|
||||
Reference in new issue
Block a user