1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-06 18:33:38 +02:00

Give user the ability to change the server url on login

This commit is contained in:
Arne Schlüter 2018-04-25 13:40:17 +02:00
commit 00e2cf656c
3 changed files with 34 additions and 18 deletions

View file

@ -1,27 +1,42 @@
(ns airsonic-ui.views
(:require [re-frame.core :refer [dispatch subscribe]]
[reagent.core :as r]
[airsonic-ui.config :as config]
[airsonic-ui.routes :as routes]
[airsonic-ui.events :as events]
[airsonic-ui.subs :as subs]))
(defn- >reset!
"Sends all target values to the given atom"
[atom]
#(reset! atom (.. % -target -value)))
;; login form
(defn login-form []
(let [user (r/atom "")
pass (r/atom "")]
pass (r/atom "")
server (r/atom config/server)]
(fn []
[:div
[:div
[:span "User"]
[:input {:type "text"
:name "user"
:on-change #(reset! user (-> % .-target .-value))}]]
:on-change (>reset! user)}]]
[:div
[:span "Password"]
[:input {:type "password" :name "pass" :on-change #(reset! pass (-> % .-target .-value))}]]
[:input {:type "password"
:name "pass"
:on-change (>reset! pass)}]]
[:div
[:button {:on-click #(dispatch [::events/authenticate @user @pass])} "Submit"]]])))
[:span "Server"]
[:input {:type "text"
:name "server"
:on-change (>reset! server)
:value @server}]]
[:div
[:button {:on-click #(dispatch [::events/authenticate @user @pass @server])} "Submit"]]])))
;; album list (start page)