Skip to content

Commit

Permalink
Show error on invalid API key
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilbadyal committed Dec 3, 2024
1 parent 0ed48bf commit 845d9bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/family.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ def synth_overage?
self.class.synth_provider&.usage&.utilization.to_i >= 100
end

def synth_valid?
self.class.synth_provider&.healthy?
end

def subscribed?
stripe_subscription_status == "active"
end
Expand Down
5 changes: 5 additions & 0 deletions app/views/pages/dashboard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Your Synth API credit limit has been exceeded. Please visit your <a href="https://dashboard.synthfinance.com/settings" class="font-medium underline hover:text-yellow-900">Synth billing settings</a> to upgrade your plan or wait for your credits to reset.
</div>
<% end %>
<% if self_hosted? && !Current.family&.synth_valid? %>
<div class="bg-yellow-100 border border-yellow-400 text-yellow-700 px-4 py-3 rounded relative" role="alert">
Your Synth API Key is invalid. Please visit your <a href="https://dashboard.synthfinance.com/dashboard" class="font-medium underline hover:text-yellow-900">Synth dashboard</a> and verify that your API key is correct.
</div>
<% end %>
<header class="flex items-center justify-between">
<div>
<h1 class="sr-only"><%= t(".title") %></h1>
Expand Down

0 comments on commit 845d9bf

Please sign in to comment.