mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 19:31:38 +02:00
Add compile time defined url variable for easy config the api url.
This commit is contained in:
parent
e5fda5aac3
commit
f80c48e679
5 changed files with 10 additions and 7 deletions
|
@ -14,6 +14,8 @@
|
||||||
:output-dir "out"
|
:output-dir "out"
|
||||||
:parallel-build false
|
:parallel-build false
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
|
:closure-defines {"uxbox.repo.core.url"
|
||||||
|
"https://test.uxbox.io/api"}
|
||||||
:language-in :ecmascript5
|
:language-in :ecmascript5
|
||||||
:language-out :ecmascript5
|
:language-out :ecmascript5
|
||||||
:target :nodejs
|
:target :nodejs
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
:asset-path "js"
|
:asset-path "js"
|
||||||
:parallel-build false
|
:parallel-build false
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
|
:closure-defines {"uxbox.repo.core.url"
|
||||||
|
"https://test.uxbox.io/api"}
|
||||||
:warnings {:ns-var-clash false}
|
:warnings {:ns-var-clash false}
|
||||||
:pretty-print true
|
:pretty-print true
|
||||||
:language-in :ecmascript5
|
:language-in :ecmascript5
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
(defn- request-token
|
(defn- request-token
|
||||||
[params]
|
[params]
|
||||||
(urc/req! {:url (str urc/+uri+ "/auth/token")
|
(urc/req! {:url (str urc/url "/auth/token")
|
||||||
:method :post
|
:method :post
|
||||||
:auth false
|
:auth false
|
||||||
:body params}))
|
:body params}))
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
[uxbox.transit :as t]
|
[uxbox.transit :as t]
|
||||||
[uxbox.state :as ust]))
|
[uxbox.state :as ust]))
|
||||||
|
|
||||||
(def ^:private ^:const +uri+
|
(goog-define url "http://127.0.0.1:5050/api")
|
||||||
"http://127.0.0.1:5050/api")
|
|
||||||
|
|
||||||
(def ^:private +storage+
|
(def ^:private +storage+
|
||||||
local-storage)
|
local-storage)
|
||||||
|
|
|
@ -20,22 +20,22 @@
|
||||||
|
|
||||||
(defmethod urc/-do :fetch/projects
|
(defmethod urc/-do :fetch/projects
|
||||||
[type data]
|
[type data]
|
||||||
(urc/req! {:url (str urc/+uri+ "/projects") :method :get}))
|
(urc/req! {:url (str urc/url "/projects") :method :get}))
|
||||||
|
|
||||||
(defmethod urc/-do :fetch/pages
|
(defmethod urc/-do :fetch/pages
|
||||||
[type data]
|
[type data]
|
||||||
(urc/req! {:url (str urc/+uri+ "/pages") :method :get}))
|
(urc/req! {:url (str urc/url "/pages") :method :get}))
|
||||||
|
|
||||||
(defmethod urc/-do :create/page
|
(defmethod urc/-do :create/page
|
||||||
[type {:keys [id] :as data}]
|
[type {:keys [id] :as data}]
|
||||||
(let [params {:url (str urc/+uri+ "/pages")
|
(let [params {:url (str urc/url "/pages")
|
||||||
:method :post
|
:method :post
|
||||||
:body data}]
|
:body data}]
|
||||||
(urc/req! params)))
|
(urc/req! params)))
|
||||||
|
|
||||||
(defmethod urc/-do :update/page
|
(defmethod urc/-do :update/page
|
||||||
[type {:keys [id] :as data}]
|
[type {:keys [id] :as data}]
|
||||||
(let [params {:url (str urc/+uri+ "/pages/" id)
|
(let [params {:url (str urc/url "/pages/" id)
|
||||||
:method :put
|
:method :put
|
||||||
:body data}]
|
:body data}]
|
||||||
(urc/req! params)))
|
(urc/req! params)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue