0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-15 03:28:25 -05:00

Modifications after review

This commit is contained in:
alonso.torres 2024-10-01 11:57:52 +02:00
parent f7f06f59ce
commit c16a116707
2 changed files with 6 additions and 10 deletions

View file

@ -7,13 +7,15 @@
(ns app.main.data.plugins (ns app.main.data.plugins
(:require (:require
[app.plugins.register :as pr] [app.plugins.register :as pr]
[app.util.globals :as ug]
[beicon.v2.core :as rx]
[potok.v2.core :as ptk])) [potok.v2.core :as ptk]))
(defn open-plugin! (defn open-plugin!
[{:keys [plugin-id name description host code icon permissions]}] [{:keys [plugin-id name description host code icon permissions]}]
(try (try
(.ɵloadPlugin (.ɵloadPlugin
js/window ^js ug/global
#js {:pluginId plugin-id #js {:pluginId plugin-id
:name name :name name
:description description :description description
@ -38,5 +40,4 @@
(watch [_ state _] (watch [_ state _]
(when-let [pid (::open-plugin state)] (when-let [pid (::open-plugin state)]
(open-plugin! (pr/get-plugin pid)) (open-plugin! (pr/get-plugin pid))
(fn [state] (rx/of #(dissoc % ::open-plugin))))))
(dissoc state ::open-plugin))))))

View file

@ -8,6 +8,7 @@
(:require (:require
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.common.spec :as us] [app.common.spec :as us]
[app.common.uri :as u]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.config :as cf] [app.config :as cf]
[app.main.data.users :as du] [app.main.data.users :as du]
@ -96,12 +97,6 @@
[router path] [router path]
(let [location (.-location js/document) (let [location (.-location js/document)
[base-path qs] (str/split path "?") [base-path qs] (str/split path "?")
qstring
(->> (str/split qs "&")
(map #(str/split % "="))
(into {}))
location-path (dm/str (.-origin location) (.-pathname location)) location-path (dm/str (.-origin location) (.-pathname location))
valid-location? (= location-path (dm/str cf/public-uri)) valid-location? (= location-path (dm/str cf/public-uri))
match (match-path router path) match (match-path router path)
@ -124,7 +119,7 @@
(st/emit! (rt/nav :auth-login)) (st/emit! (rt/nav :auth-login))
empty-path? empty-path?
(st/emit! (rt/nav :dashboard-projects {:team-id (du/get-current-team-id profile)} qstring)) (st/emit! (rt/nav :dashboard-projects {:team-id (du/get-current-team-id profile)} (u/query-string->map qs)))
:else :else
(st/emit! (rt/assign-exception {:type :not-found}))))))))) (st/emit! (rt/assign-exception {:type :not-found})))))))))