From 2eccdec73429247a6dd23fdd404ffbedc4c8b959 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Thu, 31 Aug 2023 03:26:27 +0800 Subject: [PATCH] [front/fix] truely handle 404 --- src/main/frontend/events.cljs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/frontend/events.cljs b/src/main/frontend/events.cljs index 1c6203b..54f59d4 100644 --- a/src/main/frontend/events.cljs +++ b/src/main/frontend/events.cljs @@ -40,7 +40,7 @@ :timeout 10000 :response-content-types {#"application/.*json" :json} :on-success [:get-page-success] - :on-failure [:initialize-db]} + :on-failure [:get-page-failure]} :db (-> db (assoc-in [:loading :post] true))})) @@ -52,6 +52,13 @@ (assoc-in [:loading :post] false) (assoc :post body)))) +(reg-event-db + :get-page-failure + (fn [db [_ {body :body}]] + (-> db + (assoc-in [:loading :post] false) + (assoc :post body)))) + (reg-event-db :initialize-db (fn [_ _]