forked from midday-ai/midday
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
194 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
apps/dashboard/src/actions/institutions/exchange-public-token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use server"; | ||
|
||
import Midday from "@midday-ai/engine"; | ||
|
||
const engine = new Midday(); | ||
|
||
export const exchangePublicToken = async (token: string) => { | ||
try { | ||
const { data } = await engine.auth.plaid.exchange({ token }); | ||
|
||
return data.access_token; | ||
} catch (error) { | ||
console.log(error); | ||
|
||
throw Error("Something went wrong."); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createGoCardLessLinkAction } from "@/actions/institutions/create-gocardless-link"; | ||
import { isDesktopApp } from "@todesktop/client-core/platform/todesktop"; | ||
import { useAction } from "next-safe-action/hooks"; | ||
import { BankConnectButton } from "./bank-connect-button"; | ||
|
||
type Props = { | ||
id: string; | ||
availableHistory: number; | ||
countryCode: string; | ||
onSelect: () => void; | ||
}; | ||
|
||
export function GoCardLessConnect({ | ||
onSelect, | ||
id, | ||
availableHistory, | ||
countryCode, | ||
}: Props) { | ||
const createGoCardLessLink = useAction(createGoCardLessLinkAction); | ||
|
||
const handleOnSelect = () => { | ||
onSelect(); | ||
|
||
createGoCardLessLink.execute({ | ||
institutionId: id, | ||
availableHistory: availableHistory, | ||
countryCode, | ||
redirectBase: isDesktopApp() ? "midday://" : window.location.origin, | ||
}); | ||
}; | ||
|
||
return <BankConnectButton onClick={handleOnSelect} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.