I am working on a use case as follows: The UI is with reagent, re-frame for subscription & Luminus, and for the backend, I use Compojure. I also tried with Liberator, but for simplicity, I am using only Compojure now.
I also use Secretary & cljs-ajax for SPA routing and ajax.
-> User brings up "/person" URL, and use a set of actions. The page data is sent to the backend, gets validated and saved to the DB. Then the user has to be re-directed to "/job". If there is any error, the errors will be displayed on the "/person" page.
There are two application components -- one with the URL "/person",and the other with "/job". With each of these, I have a few related pages, and I am creating them as SPA with Reagent.
The question is how do I redirect to the "/job"?
Client Side Code (only the the relevant ones)
(POST "/person"
{:headers {"Accept" "application/clojure"}
:params @doc
:handler ex-handler
:error-handler ex-error-handler})
Server:
(defn process-person []
(-> (redirect "/job" :permanent)
(header "Content-Type" "text/html; charset=utf-8")
(header "Location" "/job")
)
)
(POST "/person" [params] (process-person params))
Interestingly, on the console, I can see the HTML for the "job" page. Do I have to change the Secretary code to make it happen?
Any help is much appreciated.
Regards,
Hari