1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-22 06:39:39 +02:00

Lazy load Plaid link tokens, fix link issues on broadcast (#2302)

* Lazy load Plaid link tokens, fix link issues on broadcast

* Fix alert styles
This commit is contained in:
Zach Gollwitzer 2025-05-25 08:12:54 -04:00 committed by GitHub
parent c701755b02
commit d21e385962
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 155 additions and 123 deletions

View file

@ -6,16 +6,20 @@ export default class extends Controller {
linkToken: String,
region: { type: String, default: "us" },
isUpdate: { type: Boolean, default: false },
itemId: String
itemId: String,
};
connect() {
this.open();
}
open() {
const handler = Plaid.create({
token: this.linkTokenValue,
onSuccess: this.handleSuccess,
onLoad: this.handleLoad,
onExit: this.handleExit,
onEvent: this.handleEvent
onEvent: this.handleEvent,
});
handler.open();
@ -27,10 +31,10 @@ export default class extends Controller {
fetch(`/plaid_items/${this.itemIdValue}/sync`, {
method: "POST",
headers: {
"Accept": "application/json",
Accept: "application/json",
"Content-Type": "application/json",
"X-CSRF-Token": document.querySelector('[name="csrf-token"]').content,
}
},
}).then(() => {
// Refresh the page to show the updated status
window.location.href = "/accounts";