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

Clean up sync logic (#871)

This commit is contained in:
Zach Gollwitzer 2024-06-13 17:03:38 -04:00 committed by GitHub
parent d0a15b8a98
commit 957584b69c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 27 deletions

View file

@ -63,22 +63,11 @@ class AccountsController < ApplicationController
end
def sync
if @account.can_sync?
unless @account.syncing?
@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
redirect_to account_path(@account), notice: t(".success")
end
private