Include device token in registration response

This commit is contained in:
Shadowfacts 2024-04-07 15:48:30 -04:00
parent ba4e1d7abf
commit 26c0d2565b
1 changed files with 7 additions and 2 deletions

View File

@ -21,7 +21,8 @@ defmodule TuskerPushWeb.AppRegistrationsController do
conn conn
|> json(%{ |> json(%{
id: id, id: id,
endpoint: url(~p"/mastodon/v1/push/#{id}") endpoint: url(~p"/mastodon/v1/push/#{id}"),
device_token: token
}) })
else else
{:error, %Changeset{valid?: false} = changeset} -> {:error, %Changeset{valid?: false} = changeset} ->
@ -64,7 +65,11 @@ defmodule TuskerPushWeb.AppRegistrationsController do
{:registration, TuskerPush.get_registration(id)}, {:registration, TuskerPush.get_registration(id)},
{:ok, _} <- TuskerPush.update_registration(registration, params) do {:ok, _} <- TuskerPush.update_registration(registration, params) do
conn conn
|> json(%{id: id, endpoint: url(~p"/mastodon/v1/push/#{id}")}) |> json(%{
id: id,
endpoint: url(~p"/mastodon/v1/push/#{id}"),
device_token: token
})
else else
{:registration, nil} -> {:registration, nil} ->
conn conn