0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-16 01:31:22 -05:00

Add compile time defined url variable for easy config the api url.

This commit is contained in:
Andrey Antukh 2016-03-15 23:00:57 +02:00
parent e5fda5aac3
commit f80c48e679
5 changed files with 10 additions and 7 deletions

View file

@ -14,6 +14,8 @@
:output-dir "out"
:parallel-build false
:optimizations :none
:closure-defines {"uxbox.repo.core.url"
"https://test.uxbox.io/api"}
:language-in :ecmascript5
:language-out :ecmascript5
:target :nodejs

View file

@ -16,6 +16,8 @@
:asset-path "js"
:parallel-build false
:optimizations :none
:closure-defines {"uxbox.repo.core.url"
"https://test.uxbox.io/api"}
:warnings {:ns-var-clash false}
:pretty-print true
:language-in :ecmascript5

View file

@ -20,7 +20,7 @@
(defn- request-token
[params]
(urc/req! {:url (str urc/+uri+ "/auth/token")
(urc/req! {:url (str urc/url "/auth/token")
:method :post
:auth false
:body params}))

View file

@ -15,8 +15,7 @@
[uxbox.transit :as t]
[uxbox.state :as ust]))
(def ^:private ^:const +uri+
"http://127.0.0.1:5050/api")
(goog-define url "http://127.0.0.1:5050/api")
(def ^:private +storage+
local-storage)

View file

@ -20,22 +20,22 @@
(defmethod urc/-do :fetch/projects
[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
[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
[type {:keys [id] :as data}]
(let [params {:url (str urc/+uri+ "/pages")
(let [params {:url (str urc/url "/pages")
:method :post
:body data}]
(urc/req! params)))
(defmethod urc/-do :update/page
[type {:keys [id] :as data}]
(let [params {:url (str urc/+uri+ "/pages/" id)
(let [params {:url (str urc/url "/pages/" id)
:method :put
:body data}]
(urc/req! params)))