1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Show an error notification if account cannot be manually synced (#761)

This commit is contained in:
Jakub Kottnauer 2024-05-20 16:34:48 +02:00 committed by GitHub
parent 34811d8fd8
commit 30c19b9d2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 91 additions and 84 deletions

View file

@ -74,12 +74,20 @@ class AccountsController < ApplicationController
end
def sync
@account.sync_later if @account.can_sync?
respond_to do |format|
format.html { redirect_to account_path(@account), notice: t(".success") }
format.turbo_stream do
render turbo_stream: turbo_stream.append("notification-tray", partial: "shared/notification", locals: { type: "success", content: { body: t(".success") } })
if @account.can_sync?
@account.sync_later
respond_to do |format|
format.html { redirect_to account_path(@account), notice: t(".success") }
format.turbo_stream do
render turbo_stream: turbo_stream.append("notification-tray", partial: "shared/notification", locals: { type: "success", content: { body: t(".success") } })
end
end
else
respond_to do |format|
format.html { redirect_to account_path(@account), notice: t(".cannot_sync") }
format.turbo_stream do
render turbo_stream: turbo_stream.append("notification-tray", partial: "shared/notification", locals: { type: "error", content: { body: t(".cannot_sync") } })
end
end
end
end