-
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.
* feat: update open api client * feat: add comment field * feat: add authentification by private source * fix : sonarcloud
- Loading branch information
Showing
33 changed files
with
580 additions
and
195 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
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
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,14 @@ | ||
/* generated using openapi-typescript-codegen -- do not edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import type { PositionDTO } from './PositionDTO'; | ||
export type NumeroChangesRequestedDTO = { | ||
numero: number; | ||
suffixe?: string; | ||
nomVoie: string; | ||
parcelles: Array<string>; | ||
positions: Array<PositionDTO>; | ||
comment?: string | null; | ||
}; | ||
|
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,9 @@ | ||
/* generated using openapi-typescript-codegen -- do not edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export type PositionCoordinatesDTO = { | ||
coordinates: Array<number>; | ||
type: string; | ||
}; | ||
|
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,23 @@ | ||
/* generated using openapi-typescript-codegen -- do not edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import type { PositionCoordinatesDTO } from './PositionCoordinatesDTO'; | ||
export type PositionDTO = { | ||
point: PositionCoordinatesDTO; | ||
type: PositionDTO.type; | ||
}; | ||
export namespace PositionDTO { | ||
export enum type { | ||
ENTR_E = 'entrée', | ||
B_TIMENT = 'bâtiment', | ||
CAGE_D_ESCALIER = 'cage d’escalier', | ||
LOGEMENT = 'logement', | ||
SERVICE_TECHNIQUE = 'service technique', | ||
D_LIVRANCE_POSTALE = 'délivrance postale', | ||
PARCELLE = 'parcelle', | ||
SEGMENT = 'segment', | ||
INCONNUE = 'inconnue', | ||
} | ||
} | ||
|
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,12 @@ | ||
/* generated using openapi-typescript-codegen -- do not edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import type { PositionDTO } from './PositionDTO'; | ||
export type ToponymeChangesRequestedDTO = { | ||
nom: string; | ||
parcelles: Array<string>; | ||
positions: Array<PositionDTO>; | ||
comment?: string | null; | ||
}; | ||
|
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,9 @@ | ||
/* generated using openapi-typescript-codegen -- do not edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export type VoieChangesRequestedDTO = { | ||
nom: string; | ||
comment?: string | null; | ||
}; | ||
|
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,84 @@ | ||
import React, { useContext, useState } from 'react' | ||
import Modal from '../common/Modal' | ||
import styled from 'styled-components' | ||
import SourceContext from '../../contexts/source.context' | ||
|
||
const StyledWrapper = styled.form` | ||
.form-control { | ||
display: flex; | ||
justify-content: flex-end; | ||
width: 100%; | ||
margin-top: 20px; | ||
> button:last-of-type { | ||
margin-left: 10px; | ||
} | ||
} | ||
.fr-alert { | ||
margin-top: 20px; | ||
} | ||
` | ||
|
||
interface AuthentificationModal { | ||
onClose: () => void | ||
} | ||
|
||
export function AuthentificationModal({ onClose }: AuthentificationModal) { | ||
const [token, setToken] = useState('') | ||
const [submitStatus, setSubmitStatus] = useState<string | null>(null) | ||
const { fetchSourceByToken } = useContext(SourceContext) | ||
|
||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault() | ||
setSubmitStatus('loading') | ||
try { | ||
await fetchSourceByToken(token) | ||
setSubmitStatus('success') | ||
onClose() | ||
} catch (error) { | ||
setSubmitStatus('error') | ||
} | ||
} | ||
|
||
return ( | ||
<Modal title='Connexion' onClose={onClose}> | ||
<StyledWrapper onSubmit={handleSubmit}> | ||
<p>Connectez-vous pour accéder à vos signalements.</p> | ||
<label className='fr-label' htmlFor='nomVoie'> | ||
Renseignez votre jeton d'accès | ||
</label> | ||
<input | ||
className='fr-input' | ||
type='password' | ||
name='token' | ||
required | ||
value={token} | ||
onChange={(event) => setToken(event.target.value)} | ||
/> | ||
{submitStatus === 'success' && ( | ||
<div className='fr-alert fr-alert--success'> | ||
<p>Authentification réussie</p> | ||
</div> | ||
)} | ||
{submitStatus === 'error' && ( | ||
<div className='fr-alert fr-alert--error'> | ||
<p>Le jeton est incorrect</p> | ||
</div> | ||
)} | ||
<div className='form-control'> | ||
<button className='fr-btn fr-btn--secondary' onClick={onClose} type='button'> | ||
Annuler | ||
</button> | ||
<button | ||
className='fr-btn' | ||
type='submit' | ||
disabled={submitStatus === 'loading' || submitStatus === 'success'} | ||
> | ||
Se connecter | ||
</button> | ||
</div> | ||
</StyledWrapper> | ||
</Modal> | ||
) | ||
} |
Oops, something went wrong.