Skip to content

Commit

Permalink
feat: Pass the intentData & intentId to the Harvest Route
Browse files Browse the repository at this point in the history
  • Loading branch information
Crash-- committed Nov 14, 2023
1 parent 5441904 commit 8bc4cb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/targets/intents/HarvestRoute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useClient } from 'cozy-client'
import Intents from 'cozy-interapp'
import datacardOptions from 'cozy-harvest-lib/dist/datacards/datacardOptions'

export const HarvestRoutes = () => {
export const HarvestRoutes = ({ intentData, intentId }) => {
const { konnectorSlug } = useParams()
const client = useClient()

Expand All @@ -27,6 +27,8 @@ export const HarvestRoutes = () => {
konnectorSlug={konnectorSlug}
onDismiss={() => (service ? service.cancel() : undefined)}
datacardOptions={datacardOptions}
intentData={intentData}
intentId={intentId}
/>
</CozyTheme>
)
Expand Down
9 changes: 8 additions & 1 deletion src/targets/intents/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,21 @@ document.addEventListener('DOMContentLoaded', () => {
const container = document.querySelector('[role=application]')
const root = createRoot(container)
//
const params = new URL(document.location).searchParams
const intentId = params.get('intent')
root.render(
<AppWrapper>
<HashRouter>
<AppContext.Consumer>
{({ data }) => (
<Routes>
<Route path="/" element={<IntentHandler appData={data} />} />
<Route path=":konnectorSlug/*" element={<HarvestRoutes />} />
<Route
path=":konnectorSlug/*"
element={
<HarvestRoutes intentData={data} intentId={intentId} />
}
/>
</Routes>
)}
</AppContext.Consumer>
Expand Down

0 comments on commit 8bc4cb6

Please sign in to comment.