wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

:art: pipe the data while reading and parsing the body

Kacaii 05fc7cc1 4c379205

+9 -11
+9 -11
src/app/web/socket.gleam
··· 255 255 |> process.select(group_subject) 256 256 |> process.select(user_subject) 257 257 258 - // 󰘦 Parse body 259 - let body = read_body(req) 260 - let subscribed_result = parse_body(result.unwrap(body, "")) 258 + let subscribed = 259 + read_body(req) 260 + |> result.unwrap("") 261 + |> parse_body 262 + |> result.unwrap([]) 261 263 262 - #( 263 - State(user_uuid:, subscribed: result.unwrap(subscribed_result, [])), 264 - option.Some(selector), 265 - ) 264 + #(State(user_uuid:, subscribed:), option.Some(selector)) 266 265 } 267 266 268 267 fn parse_body(body: String) -> Result(List(category.Category), json.DecodeError) { ··· 301 300 ctx _ctx: Context, 302 301 registry registry: group_registry.GroupRegistry(msg.Msg), 303 302 ) -> Nil { 304 - group_registry.leave(registry, topic, [process.self()]) 305 - group_registry.leave(registry, uuid.to_string(state.user_uuid), [ 306 - process.self(), 307 - ]) 303 + let self = process.self() 304 + group_registry.leave(registry, topic, [self]) 305 + group_registry.leave(registry, uuid.to_string(state.user_uuid), [self]) 308 306 } 309 307 310 308 // HELPERS ---------------------------------------------------------------------