From 17ce53a144b0afeddfed91780fef4b55e77b52c0 Mon Sep 17 00:00:00 2001 From: Alexandre de Souza Date: Wed, 29 Nov 2023 13:58:56 -0300 Subject: [PATCH] Fix when creating a new org (#2375) --- lib/livebook/teams/requests.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/livebook/teams/requests.ex b/lib/livebook/teams/requests.ex index 1a55dfdb8..250d7e79e 100644 --- a/lib/livebook/teams/requests.ex +++ b/lib/livebook/teams/requests.ex @@ -190,8 +190,9 @@ defmodule Livebook.Teams.Requests do defp post(path, json, team \\ nil) do body = {"application/json", Jason.encode!(json)} + headers = if team, do: auth_headers(team), else: [] - request(:post, path, body: body, headers: auth_headers(team)) + request(:post, path, body: body, headers: headers) |> dispatch_messages(team) end @@ -240,7 +241,7 @@ defmodule Livebook.Teams.Requests do end end - defp dispatch_messages({:ok, %{"messages" => _} = body}, team) do + defp dispatch_messages({:ok, %{"messages" => _} = body}, %Livebook.Hubs.Team{} = team) do {messages, body} = Map.pop!(body, "messages") for message <- messages do