this repo has no description
lustre frontent oat-ui gleam
0
fork

Configure Feed

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

๐Ÿšš rename fields to "self"

+14 -16
+4 -4
src/client/route.gleam
··· 22 22 } 23 23 24 24 /// ๏‹ƒ Some routes might require authentication in order to be accessed 25 - pub fn is_protected(route: Route) -> Bool { 26 - case route { 25 + pub fn is_protected(self: Route) -> Bool { 26 + case self { 27 27 Login | NotFound | Home -> False 28 28 _ -> True 29 29 } ··· 39 39 } 40 40 } 41 41 42 - pub fn path(route: Route) -> String { 43 - case route { 42 + pub fn path(self: Route) -> String { 43 + case self { 44 44 Home -> "/" 45 45 Login -> "/login" 46 46 Dashboard -> "/dashboard"
+6 -7
src/client/session/token.gleam
··· 15 15 decode.success(Token(access_token:, token_type:, user:)) 16 16 } 17 17 18 - pub fn to_json(token: Token) -> json.Json { 19 - let Token(access_token:, token_type:, user:) = token 18 + pub fn to_json(self: Token) -> json.Json { 20 19 json.object([ 21 - #("access_token", json.string(access_token)), 22 - #("token_type", json.string(token_type)), 23 - #("user", user.to_json(user)), 20 + #("access_token", json.string(self.access_token)), 21 + #("token_type", json.string(self.token_type)), 22 + #("user", user.to_json(self.user)), 24 23 ]) 25 24 } 26 25 27 - pub fn include(req: request.Request(_), token: Token) -> request.Request(_) { 26 + pub fn set_header(self: Token, req: request.Request(_)) -> request.Request(_) { 28 27 let value = 29 - to_json(token) 28 + to_json(self) 30 29 |> json.to_string 31 30 32 31 request.set_header(req, "authorization", "bearer " <> value)
+4 -5
src/client/user.gleam
··· 5 5 User(id: String, full_name: String, email: String) 6 6 } 7 7 8 - pub fn to_json(user: User) -> json.Json { 9 - let User(id:, full_name:, email:) = user 8 + pub fn to_json(self: User) -> json.Json { 10 9 json.object([ 11 - #("id", json.string(id)), 12 - #("full_name", json.string(full_name)), 13 - #("email", json.string(email)), 10 + #("id", json.string(self.id)), 11 + #("full_name", json.string(self.full_name)), 12 + #("email", json.string(self.email)), 14 13 ]) 15 14 } 16 15