EpochtalkServerWeb.UserView (epochtalk_server v0.1.0)

Renders and formats User data, in JSON format for frontend

Link to this section Summary

Functions

The resource name, as an atom, for this view

Renders formatted JSON response for registration confirmation.

Renders whatever data it is passed when template not found. Data pass through for rendering misc responses (ex: {found: true} or {success: true})

Link to this section Functions

The resource name, as an atom, for this view

Link to this function

render(template, assigns \\ %{})

Renders formatted JSON response for registration confirmation.

example

Example

iex> EpochtalkServerWeb.UserView.render("register_with_verify.json", %{user: %User{ username: "Test" }}) %{

username: "Test",
confirm_token: true,
message: "Successfully registered, please confirm account to login."

}

Link to this function

template_not_found(template, assigns)

@spec template_not_found(Phoenix.Template.name(), map()) :: no_return()

Renders whatever data it is passed when template not found. Data pass through for rendering misc responses (ex: {found: true} or {success: true})

example

Example

iex> EpochtalkServerWeb.UserView.render("DoesNotExist.json", data: %{found: true})
%{found: true}
iex> EpochtalkServerWeb.UserView.render("DoesNotExist.json", data: %{success: true})
%{success: true}