-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📏 Active le mode strict de TypeScript sur la partie mon-entreprise
- Loading branch information
1 parent
d7f1403
commit b2cee93
Showing
45 changed files
with
518 additions
and
275 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@types/react-native |
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 was deleted.
Oops, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { ApiCommuneJson } from 'Components/conversation/select/SelectCommune' | ||
import { fetchCompanyDetails } from '../api/sirene' | ||
|
||
const fetchCommuneDetails = function(codeCommune: string) { | ||
return fetch( | ||
`https://geo.api.gouv.fr/communes/${codeCommune}?fields=departement,region` | ||
).then(response => { | ||
return response.json() | ||
}) | ||
} | ||
|
||
export type ActionExistingCompany = | ||
| ReturnType<typeof specifyIfAutoEntrepreneur> | ||
| ReturnType<typeof specifyIfDirigeantMajoritaire> | ||
| ReturnType<typeof resetEntreprise> | ||
| { | ||
type: 'EXISTING_COMPANY::SET_SIREN' | ||
siren: string | ||
} | ||
| { | ||
type: 'EXISTING_COMPANY::SET_DETAILS' | ||
catégorieJuridique: string | ||
dateDeCréation: string | ||
} | ||
| { | ||
type: 'EXISTING_COMPANY::ADD_COMMUNE_DETAILS' | ||
details: ApiCommuneJson | ||
} | ||
|
||
export const setEntreprise = (siren: string) => async ( | ||
dispatch: (action: ActionExistingCompany) => void | ||
) => { | ||
dispatch({ | ||
type: 'EXISTING_COMPANY::SET_SIREN', | ||
siren | ||
} as ActionExistingCompany) | ||
const companyDetails = await fetchCompanyDetails(siren) | ||
dispatch({ | ||
type: 'EXISTING_COMPANY::SET_DETAILS', | ||
catégorieJuridique: companyDetails.categorie_juridique, | ||
dateDeCréation: companyDetails.date_creation | ||
}) | ||
const communeDetails: ApiCommuneJson = await fetchCommuneDetails( | ||
companyDetails.etablissement_siege.code_commune | ||
) | ||
dispatch({ | ||
type: 'EXISTING_COMPANY::ADD_COMMUNE_DETAILS', | ||
details: communeDetails | ||
} as ActionExistingCompany) | ||
} | ||
|
||
export const specifyIfAutoEntrepreneur = (isAutoEntrepreneur: boolean) => | ||
({ | ||
type: 'EXISTING_COMPANY::SPECIFY_AUTO_ENTREPRENEUR', | ||
isAutoEntrepreneur | ||
} as const) | ||
|
||
export const specifyIfDirigeantMajoritaire = ( | ||
isDirigeantMajoritaire: boolean | ||
) => | ||
({ | ||
type: 'EXISTING_COMPANY::SPECIFY_DIRIGEANT_MAJORITAIRE', | ||
isDirigeantMajoritaire | ||
} as const) | ||
|
||
export const resetEntreprise = () => | ||
({ | ||
type: 'EXISTING_COMPANY::RESET' | ||
} as const) |
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
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
4 changes: 2 additions & 2 deletions
4
mon-entreprise/source/components/conversation/ParagrapheInput.tsx
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.