diff --git a/lib/outlook/translators/deepl.ex b/lib/outlook/translators/deepl.ex index b94c7f8..6223405 100644 --- a/lib/outlook/translators/deepl.ex +++ b/lib/outlook/translators/deepl.ex @@ -55,15 +55,15 @@ defmodule Outlook.Translators.Deepl do response = Jason.decode!(response_raw.body, keys: :atoms) case response do - %{status: "translating"} -> + %{status: "done"} -> + response + %{status: status} -> steps = response.seconds_remaining * 5 for n <- 0..steps do - send(pid, {:progress, %{progress: 100 * n / steps}}) + send(pid, {:progress, %{progress: 100 * n / steps, status: status}}) Process.sleep 200 end check_status(pid, credentials) - %{status: "done"} -> - response end end