0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00

fix(frontend): fix image uploading

This commit is contained in:
Andrey Antukh 2019-07-05 09:41:20 +02:00
parent b6b6fdf115
commit 820edba113
3 changed files with 30 additions and 27 deletions

View file

@ -49,7 +49,7 @@
(and (:status error) (and (:status error)
(or (= (:status error) 403) (or (= (:status error) 403)
(= (:status error) 419))) (= (:status error) 419)))
(ts/schedule 100 #(st/emit! (logout))) (ts/schedule 0 #(st/emit! (rt/nav :auth-login)))
;; Conflict ;; Conflict
(= status 412) (= status 412)

View file

@ -55,12 +55,14 @@
[_ {:keys [collection id file width height mimetype] :as body}] [_ {:keys [collection id file width height mimetype] :as body}]
(let [body (doto (js/FormData.) (let [body (doto (js/FormData.)
(.append "mimetype" mimetype) (.append "mimetype" mimetype)
(.append "collection" (str collection))
(.append "file" file) (.append "file" file)
(.append "width" width) (.append "width" width)
(.append "height" height) (.append "height" height)
(.append "id" id)) (.append "id" id))
params {:url (str url "/library/images/") _ (when collection
(.append body "collection" (str collection)))
params {:url (str url "/library/images")
:method :post :method :post
:body body}] :body body}]
(send! params))) (send! params)))

View file

@ -2,33 +2,34 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;; ;;
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com> ;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
;; Copyright (c) 2015-2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.ui (ns uxbox.main.ui
(:require [beicon.core :as rx] (:require
[lentes.core :as l] [beicon.core :as rx]
[cuerdas.core :as str] [cuerdas.core :as str]
[potok.core :as ptk] [lentes.core :as l]
[uxbox.builtins.icons :as i] [potok.core :as ptk]
[uxbox.main.store :as st] [rumext.core :as mx :include-macros true]
[uxbox.main.data.projects :as dp] [uxbox.builtins.icons :as i]
[uxbox.main.data.auth :refer [logout]] [uxbox.main.data.auth :refer [logout]]
[uxbox.main.ui.loader :refer [loader]] [uxbox.main.data.projects :as dp]
[uxbox.main.ui.lightbox :refer [lightbox]] [uxbox.main.store :as st]
[uxbox.main.ui.auth :as auth] [uxbox.main.ui.auth :as auth]
[uxbox.main.ui.dashboard :as dashboard] [uxbox.main.ui.dashboard :as dashboard]
[uxbox.main.ui.settings :as settings] [uxbox.main.ui.lightbox :refer [lightbox]]
[uxbox.main.ui.workspace :refer [workspace]] [uxbox.main.ui.loader :refer [loader]]
[uxbox.main.ui.shapes] [uxbox.main.ui.settings :as settings]
[uxbox.util.messages :as uum] [uxbox.main.ui.shapes]
[uxbox.util.html-history :as html-history] [uxbox.main.ui.workspace :refer [workspace]]
[uxbox.util.router :as rt] [uxbox.util.data :refer [parse-int uuid-str?]]
[uxbox.util.timers :as ts] [uxbox.util.dom :as dom]
[uxbox.util.i18n :refer [tr]] [uxbox.util.html-history :as html-history]
[uxbox.util.data :refer [parse-int uuid-str?]] [uxbox.util.i18n :refer [tr]]
[uxbox.util.dom :as dom] [uxbox.util.messages :as uum]
[rumext.core :as mx :include-macros true])) [uxbox.util.router :as rt]
[uxbox.util.timers :as ts]))
;; --- Refs ;; --- Refs