Commit 2ed789a8 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[share] fix JSON serialization of ShareNodeParams

parent d2807c50
......@@ -22,6 +22,7 @@ import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Utils.SimpleJSON as GUSJ
import Gargantext.Utils.Reactix as R2
here :: R2.Here
......@@ -41,8 +42,12 @@ data ShareNodeParams = ShareTeamParams { username :: String }
| SharePublicParams { node_id :: Int }
derive instance Eq ShareNodeParams
derive instance Generic ShareNodeParams _
instance JSON.ReadForeign ShareNodeParams where readImpl = JSONG.untaggedSumRep
instance JSON.WriteForeign ShareNodeParams where writeImpl = JSON.writeImpl <<< show
instance JSON.ReadForeign ShareNodeParams where readImpl = GUSJ.taggedSumRep
instance JSON.WriteForeign ShareNodeParams where
writeImpl (ShareTeamParams { username }) = JSON.writeImpl { "type": "ShareTeamParams"
, username }
writeImpl (SharePublicParams { node_id }) = JSON.writeImpl { "type": "SharePublicParams"
, node_id }
instance Show ShareNodeParams where show = genericShow
------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment