Assign static value to `Let`?

Let(
  params: {
    membership: {
      resource: Collection("users")
    },
    privileges: [
      {
        resource: Function("login"),
        actions: {
          call: true
        }
      }
    ]
  },
  If(
    Exists(Role('guest')),
    Update(Role('guest'), Var('params')),
    Create(Role('guest'), Var('params'))
  )
)

Running the code above on the Dashboard Shell will result to Error: missing ) after argument list

In fact, just running:

Let(
  params: {},
  Var("params")
)

throws the same error.

Bindings, the first argument of Let should be wrapped in curly braces.

So this should work:

Let({
  params: {
    membership: {
      resource: Collection("users")
    },
    privileges: [
      {
        resource: Function("login"),
        actions: {
          call: true
        }
      }
    ]
  }},
  If(
    Exists(Role('guest')),
    Update(Role('guest'), Var('params')),
    Create(Role('guest'), Var('params'))
  )
)

Right! totally missed that! Thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.