mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
Handle events via UI instead of just the REPL
This commit is contained in:
parent
d782b49b94
commit
afe5b4015f
2 changed files with 37 additions and 19 deletions
|
|
@ -1,24 +1,29 @@
|
|||
(ns airsonic-ui.views
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[airsonic-ui.config :as config]
|
||||
[reagent.core :as r]
|
||||
[airsonic-ui.events :as events]
|
||||
[airsonic-ui.subs :as subs]))
|
||||
|
||||
(defn login-form []
|
||||
[:form {:method "get"
|
||||
:action config/server
|
||||
:on-click #(js/alert "bang bang! TODO: implement login via form")}
|
||||
[:div
|
||||
[:span "User"]
|
||||
[:input {:type "text" :name "user"}]]
|
||||
[:div
|
||||
[:span "Password"]
|
||||
[:input {:type "password" :name "pass"}]]
|
||||
[:div
|
||||
[:input {:type "submit" :value "submit"}]]])
|
||||
(let [user (r/atom "")
|
||||
pass (r/atom "")]
|
||||
(fn []
|
||||
[:div
|
||||
[:div
|
||||
[:span "User"]
|
||||
[:input {:type "text"
|
||||
:name "user"
|
||||
:on-change #(reset! user (-> % .-target .-value))}]]
|
||||
[:div
|
||||
[:span "Password"]
|
||||
[:input {:type "password" :name "pass" :on-change #(reset! pass (-> % .-target .-value))}]]
|
||||
[:div
|
||||
[:button {:on-click #(re-frame/dispatch [::events/authenticate @user @pass])} "Submit"]]])))
|
||||
|
||||
(defn app [user]
|
||||
[:div
|
||||
[:h2 (str "Currently logged in as " user)]])
|
||||
[:h2 (str "Currently logged in as " user)]
|
||||
[:a {:on-click #(re-frame/dispatch [::events/initialize-db]) :href "#"} "Logout"]])
|
||||
|
||||
(defn main-panel []
|
||||
[:div
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue