mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 07:27:13 +02:00
✨ Make team leave & reassing as atomic operation.
This commit is contained in:
parent
b68d721b39
commit
54f8487b46
2 changed files with 42 additions and 18 deletions
|
@ -397,16 +397,13 @@
|
|||
(let [{:keys [on-success on-error]
|
||||
:or {on-success identity
|
||||
on-error rx/throw}} (meta params)
|
||||
team-id (:current-team-id state)]
|
||||
(rx/concat
|
||||
(when (uuid? reassign-to)
|
||||
(->> (rp/mutation! :update-team-member-role {:team-id team-id
|
||||
:role :owner
|
||||
:member-id reassign-to})
|
||||
(rx/ignore)))
|
||||
(->> (rp/mutation! :leave-team {:id team-id})
|
||||
(rx/tap on-success)
|
||||
(rx/catch on-error)))))))
|
||||
team-id (:current-team-id state)
|
||||
params (cond-> {:id team-id}
|
||||
(uuid? reassign-to)
|
||||
(assoc :reassign-to reassign-to))]
|
||||
(->> (rp/mutation! :leave-team params)
|
||||
(rx/tap on-success)
|
||||
(rx/catch on-error))))))
|
||||
|
||||
(defn invite-team-member
|
||||
[{:keys [email role] :as params}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue