diff --git a/.formatter.exs b/.formatter.exs index d7ce1ef..2da3269 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,5 +1,5 @@ [ - import_deps: [:ecto, :phoenix], + import_deps: [:phoenix], plugins: [Phoenix.LiveView.HTMLFormatter], inputs: [ "*.{heex,ex,exs}", diff --git a/config/dev.exs b/config/dev.exs index d356ff3..36267ad 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -13,9 +13,11 @@ config :app, AppWeb.Endpoint, check_origin: false, code_reloader: true, debug_errors: true, - secret_key_base: "bv1heeBXJGvlEsc6SI66xUox+004UlT+aRAH+UlGgMxGuGMXCbEK32pVx0QNlJxN", + secret_key_base: + "bv1heeBXJGvlEsc6SI66xUox+004UlT+aRAH+UlGgMxGuGMXCbEK32pVx0QNlJxN", watchers: [ - esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}, + esbuild: + {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}, tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]} ] diff --git a/config/prod.exs b/config/prod.exs index 608ef13..31b5cab 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -9,7 +9,8 @@ import Config # manifest is generated by the `mix phx.digest` task, # which you should run after static files are built and # before starting your production server. -config :app, AppWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json" +config :app, AppWeb.Endpoint, + cache_static_manifest: "priv/static/cache_manifest.json" # Do not print debug messages in production config :logger, level: :info diff --git a/config/test.exs b/config/test.exs index 5c7457b..2fceb3e 100644 --- a/config/test.exs +++ b/config/test.exs @@ -4,7 +4,8 @@ import Config # you can enable the server option below. config :app, AppWeb.Endpoint, http: [ip: {127, 0, 0, 1}, port: 4002], - secret_key_base: "lrn6ftfPZu7KSTQ54v4foc/gq2FgYfB9/ckQw+Hhi/NNcUM7nf/mUlTqZWJOXAoK", + secret_key_base: + "lrn6ftfPZu7KSTQ54v4foc/gq2FgYfB9/ckQw+Hhi/NNcUM7nf/mUlTqZWJOXAoK", server: false # Print only warnings and errors during test diff --git a/example.md b/example.md index a0a068b..3b00555 100644 --- a/example.md +++ b/example.md @@ -63,6 +63,7 @@ Or navigate directly to it: ![stripe-test-api-keys](https://user-images.githubusercontent.com/194400/211688826-429d2905-49f9-4974-8654-08b3607b43f5.png) > **Note**: don't worry, these `API Keys` aren't valid. +> This is just for illustration purposes. The **_Test_ API keys** will be used later. Save them and don't share them with anyone. @@ -90,8 +91,8 @@ you will be able to see the default landing page. We want the `person` using the `App` to be able to log in. We will check if they have *paid* or not for using the `App`. -If he hasn't, he is redirected to a `buy` page. -If he has, he will have access to it! +If they haven't, they are redirected to a `buy` page. +If they have, they will have access to it! It's a simple `App`, for sure. But it's still important diff --git a/lib/app/users.ex b/lib/app/users.ex index 860e7af..aaac0e1 100644 --- a/lib/app/users.ex +++ b/lib/app/users.ex @@ -1,27 +1,39 @@ defmodule UsersTable do - alias Pockets - @table (if Mix.env() == :prod do :users_table else :users_test_table end) - @filepath (if Mix.env() == :prod do "cache.dets" else "cache_test.dets" end) + @table (if Mix.env() == :prod do + :users_table + else + :users_test_table + end) + @filepath (if Mix.env() == :prod do + "cache.dets" + else + "cache_test.dets" + end) def init() do case Pockets.new(@table, @filepath) do # Not testing creating a table because when testing, it loads a sample table. # coveralls-ignore-start - {:ok, set} -> {:ok, set} + {:ok, set} -> + {:ok, set} + # coveralls-ignore-end {:error, _} -> Pockets.open(@table, @filepath) end end - def create_user(%{:stripe_id => stripe_id, :person_id => person_id, :status => status}) do + def create_user(%{ + :stripe_id => stripe_id, + :person_id => person_id, + :status => status + }) do Pockets.put(@table, person_id, %{stripe_id: stripe_id, status: status}) end def fetch_user(person_id) do Pockets.get(@table, person_id) end - end diff --git a/lib/app_web/components/core_components.ex b/lib/app_web/components/core_components.ex index f40abef..dff9ee6 100644 --- a/lib/app_web/components/core_components.ex +++ b/lib/app_web/components/core_components.ex @@ -47,8 +47,16 @@ defmodule AppWeb.CoreComponents do def modal(assigns) do ~H""" -