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:
parent
c701755b02
commit
d21e385962
19 changed files with 155 additions and 123 deletions
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue