Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
downgrade to working commit
Browse files Browse the repository at this point in the history
  • Loading branch information
movefasta committed May 18, 2018
1 parent cfbed46 commit c7485a7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
10 changes: 5 additions & 5 deletions src/Commands.elm
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ rootHashUpdate node acc path =
case
-}
getPureData : Link -> Cmd Msg
getPureData link =
Http.getString ( ipfsGatewayUrl ++ link.hash )
getPureData : Hash -> Cmd Msg
getPureData hash =
Http.getString ( ipfsGatewayUrl ++ hash )
|> RemoteData.sendRequest
|> Cmd.map (Msgs.UpdatePureData link)
|> Cmd.map Msgs.UpdatePureData

{-}
getData : List Link -> Cmd Msg
Expand Down Expand Up @@ -148,7 +148,7 @@ linkDecoder =
|> required "Name" Decode.string
|> required "Hash" Decode.string
|> required "Size" Decode.int
|> hardcoded ""


headerDecoder : Decode.Decoder ModifiedObject
headerDecoder =
Expand Down
1 change: 0 additions & 1 deletion src/Models.elm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type alias Link =
{ name : Name
, hash : Hash
, size : Int
, data : Data
}

type alias Header =
Expand Down
2 changes: 1 addition & 1 deletion src/Msgs.elm
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ type Msg
| GetModifiedObject (WebData Hash)
| GetObject (WebData Object)
| GetIpfsHash (WebData Hash)
| UpdatePureData (WebData String) Link
| UpdatePureData (WebData String)
| GetData Hash
18 changes: 6 additions & 12 deletions src/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ update msg model =
object =
RemoteData.withDefault {links = [], data = ""} response
in

( { model | object = object }, Cmd.batch <| List.map (\a -> getPureData a.hash) object.links )
( { model | object = object }, Cmd.batch <| List.map (\a -> getPureData a.hash) object.links )

Msgs.GetModifiedObject response ->
let
Expand All @@ -45,21 +44,16 @@ update msg model =

Msgs.UpdatePureData response ->
let
object =
model.object
links =
object.links
data = RemoteData.withDefault "" response
newData =
{ object | link = { link | data = data } }
newData = RemoteData.withDefault "" response
in
( { model | object = newData }, Cmd.none )
( { model | data = newData }, Cmd.none )

Msgs.RemoveLink link ->
( model, removeLink model.hash link )

Msgs.AddLink name hash ->
( model, addLink model.hash name hash )

{-
Msgs.GetData link ->
( model, getPureData link.hash )
( model, getPureData link.hash )}
-}
5 changes: 0 additions & 5 deletions src/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ viewLink link =
, Event.onClick <| Msgs.GetObjectRequest link.name link.hash
]
<| E.text link.name
, E.button None
[ padding 5
, Event.onClick <| Msgs.GetData link.hash
]
<| E.text link.data
, E.button None
[ padding 5
, Event.onClick <| Msgs.RemoveLink link
Expand Down

0 comments on commit c7485a7

Please sign in to comment.