GET /networks endpoint for development server

Signed-off-by: Aleksandr Pantiukhov <alwxndr@gmail.com>
This commit is contained in:
Aleksandr Pantiukhov 2018-10-28 14:50:18 +01:00
parent b293fb11e3
commit 654950dcaa
No known key found for this signature in database
GPG Key ID: 153E4F21734042F5
1 changed files with 11 additions and 0 deletions

View File

@ -50,6 +50,17 @@
:network-id network-id
:reason reason}]})}))
(defmethod process-request! [:GET "networks" nil]
[{:keys [cofx]}]
(let [{:keys [networks network]} (get-in cofx [:db :account/account])
networks (->> networks
(map (fn [[id m]]
[id (-> m
(select-keys [:id :name :config])
(assoc :active? (= id network)))]))
(into {}))]
{:dev-server/respond [200 {:networks networks}]}))
(defmethod process-request! [:DELETE "network" nil]
[{:keys [cofx data]}]
(network/delete