refactor: refactoring du FRONT page subscribe

This commit is contained in:
Luc SORIGNET
2025-01-12 14:37:49 +01:00
parent 58fe509734
commit 427b6c7588
25 changed files with 671 additions and 652 deletions

View File

@ -10,7 +10,7 @@ import Loader from '@/components/Loader'; // Importez le composant Loader
import Button from '@/components/Button'; // Importez le composant Button
import Popup from '@/components/Popup'; // Importez le composant Popup
import { User, KeySquare } from 'lucide-react'; // Importez directement les icônes nécessaires
import { BK_REGISTER_URL, FR_USERS_LOGIN_URL } from '@/utils/Url';
import { BE_AUTH_REGISTER_URL, FE_USERS_LOGIN_URL } from '@/utils/Url';
import useCsrfToken from '@/hooks/useCsrfToken';
const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
@ -41,7 +41,7 @@ export default function Page() {
setErrorMessage("")
setIsLoading(false);
} else {
const url= `${BK_REGISTER_URL}`;
const url= `${BE_AUTH_REGISTER_URL}`;
fetch(url, {
headers: {
'Content-Type': 'application/json',
@ -100,11 +100,11 @@ export default function Page() {
}
} else {
const request = new Request(
`${BK_REGISTER_URL}`,
`${BE_AUTH_REGISTER_URL}`,
{
method:'POST',
headers: {
'Content-Type':'application/json',
'Content-Type':'application/json',
'X-CSRFToken': csrfToken
},
credentials: 'include',
@ -164,14 +164,14 @@ export default function Page() {
</div>
</form>
<br/>
<div className='flex justify-center mt-2 max-w-md mx-auto'><Button text="Annuler" className="w-full" onClick={()=>{router.push(`${FR_USERS_LOGIN_URL}`)}} /></div>
<div className='flex justify-center mt-2 max-w-md mx-auto'><Button text="Annuler" className="w-full" onClick={()=>{router.push(`${FE_USERS_LOGIN_URL}`)}} /></div>
</div>
<Popup
visible={popupVisible}
message={popupMessage}
onConfirm={() => {
setPopupVisible(false);
router.push(`${FR_USERS_LOGIN_URL}`);
router.push(`${FE_USERS_LOGIN_URL}`);
}}
onCancel={() => setPopupVisible(false)}
/>