You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
** (FunctionClauseError) no function clause matching in Map.from_struct/1
The following arguments were given to Map.from_struct/1:
# 1
[event: "onload", src: "https://djavaskripped.org/fancy.js"]
Attempted function clauses (showing 2 out of 2):
def from_struct(struct) when is_atom(struct)
def from_struct(%_{} = struct)
(elixir) lib/map.ex:849: Map.from_struct/1
(shopify) lib/shopify/resources/script_tag.ex:6: Shopify.ScriptTag.to_json/1
(shopify) lib/shopify/resources/script_tag.ex:6: Shopify.ScriptTag.create/2
I don't know if I'm doing it right ?
The text was updated successfully, but these errors were encountered:
The problem is, you are using a named list as the arguments [event: "onload", src: "https://djavaskripped.org/fancy.js"], but you need to use the according Struct to create a resource.
This provides a kind of type safety, you are only able to send fields that are defined in the struct, but it also means a little more typing on your end 😬
I'm trying to perform a scripttag, but it shows me this error:
Shopify.ScriptTag.create(session, [event: "onload", src: "https://djavaskripped.org/fancy.js"])
The result:
I don't know if I'm doing it right ?
The text was updated successfully, but these errors were encountered: