From 8a968dc081829a7294ec5a00ed848c6fc9d0a240 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 31 Jan 2023 13:26:28 +0100 Subject: [PATCH] :bug: Fix upload team image --- frontend/src/app/main/data/dashboard.cljs | 4 ++-- frontend/src/app/main/repo.cljs | 9 +++++++++ frontend/src/app/main/ui/dashboard/team.cljs | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 8e84b6a21..3cd752a52 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -426,8 +426,8 @@ (rx/ignore))))) (defn update-team-photo - [{:keys [file] :as params}] - (us/assert! ::di/file file) + [file] + (us/assert! ::di/blob file) (ptk/reify ::update-team-photo ptk/WatchEvent (watch [_ state _] diff --git a/frontend/src/app/main/repo.cljs b/frontend/src/app/main/repo.cljs index 55c2e3976..594c1f3b4 100644 --- a/frontend/src/app/main/repo.cljs +++ b/frontend/src/app/main/repo.cljs @@ -200,3 +200,12 @@ :body (http/form-data params)}) (rx/map http/conditional-decode-transit) (rx/mapcat handle-response))) + +(defmethod command ::multipart-upload + [id params] + (->> (http/send! {:method :post + :uri (u/join @cf/public-uri "api/rpc/command/" (name id)) + :credentials "include" + :body (http/form-data params)}) + (rx/map http/conditional-decode-transit) + (rx/mapcat handle-response))) diff --git a/frontend/src/app/main/ui/dashboard/team.cljs b/frontend/src/app/main/ui/dashboard/team.cljs index b1450a734..8c0becf46 100644 --- a/frontend/src/app/main/ui/dashboard/team.cljs +++ b/frontend/src/app/main/ui/dashboard/team.cljs @@ -888,7 +888,7 @@ on-file-selected (fn [file] - (st/emit! (dd/update-team-photo {:file file})))] + (st/emit! (dd/update-team-photo file)))] (mf/use-effect