mirror of
https://github.com/penpot/penpot.git
synced 2026-08-20 03:38:52 +00:00
When copying an access token over plain HTTP (non-secure context), the browser does not expose navigator.clipboard, causing to-clipboard to return a rejected Promise. The caller was ignoring the Promise entirely, so the rejection became an unhandled exception that crashed the UI. Fix: chain .then/.catch on the returned Promise so that a successful copy shows the existing success toast and a failure (including insecure-origin) shows an error toast using the existing errors.clipboard-api-unavailable translation key. Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
b4bc3dfe6a
commit
904570f970
@ -79,13 +79,19 @@
|
||||
(mf/deps token-created)
|
||||
(fn [event]
|
||||
(dom/prevent-default event)
|
||||
(clipboard/to-clipboard (:token token-created))
|
||||
(st/emit! (ntf/show {:level :info
|
||||
:type :toast
|
||||
:content (if is-mcp
|
||||
(tr "integrations.notification.success.mcp-key-copied")
|
||||
(tr "integrations.notification.success.token-copied"))
|
||||
:timeout notification-timeout}))))]
|
||||
(-> (clipboard/to-clipboard (:token token-created))
|
||||
(.then (fn [_]
|
||||
(st/emit! (ntf/show {:level :info
|
||||
:type :toast
|
||||
:content (if is-mcp
|
||||
(tr "integrations.notification.success.mcp-key-copied")
|
||||
(tr "integrations.notification.success.token-copied"))
|
||||
:timeout notification-timeout}))))
|
||||
(.catch (fn [_]
|
||||
(st/emit! (ntf/show {:level :error
|
||||
:type :toast
|
||||
:content (tr "errors.clipboard-api-unavailable")
|
||||
:timeout notification-timeout})))))))]
|
||||
|
||||
[:div {:class (stl/css :modal-form)}
|
||||
[:> text* {:as "h2"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user