STN-218 : Integrate the authentication and registration APIs
9 fils de conversation non résolus
9 fils de conversation non résolus
Closes STN-218
Rapports de requête de fusion
Activité
Filtrer l'activité
requested review from @ahlame.elbahry
assigned to @ahlame.elbahry
@ahlame.elbahry please resolve the merge conflicts
219 224 220 // LOGIN 221 222 225 const login = useCallback(async (email: string, password: string): Promise<void> => { 223 console.log("Attempting login with email:", email); 224 225 const user = users.find(u => u.email === email && u.password === password); 226 227 if (user) { 228 console.log("User found:", user); 229 230 const accessToken = sessionStorage.getItem(STORAGE_KEY); 231 console.log("Access token retrieved from session storage:", accessToken); 232 226 try { 227 const response = await fetch('http://localhost:8082/auth/signin', { changed this line in version 2 of the diff
219 224 220 // LOGIN 221 222 225 const login = useCallback(async (email: string, password: string): Promise<void> => { 223 console.log("Attempting login with email:", email); 224 225 const user = users.find(u => u.email === email && u.password === password); 226 227 if (user) { 228 console.log("User found:", user); 229 230 const accessToken = sessionStorage.getItem(STORAGE_KEY); 231 console.log("Access token retrieved from session storage:", accessToken); 232 226 try { 227 const response = await fetch('http://localhost:8082/auth/signin', { changed this line in version 2 of the diff
232 226 try { 227 const response = await fetch('http://localhost:8082/auth/signin', { 228 method: 'POST', 229 headers: { 'Content-Type': 'application/json' }, 230 body: JSON.stringify({username: email , password: password}), }); 231 232 const result = await response.json(); 233 const decodedToken = jwtDecode<CustomJwtPayload>(result.token); 234 const accessToken = result.token; 235 const roles = decodedToken.realm_access?.roles || []; 236 237 const role = roles.includes('USER') ? 'user' : roles.includes('ADMIN') ? 'admin' : 'employee'; 238 239 localStorage.setItem('role', role); 240 const response_user = await fetch(`http://localhost:8082/user?email=${encodeURIComponent(email)}`, { changed this line in version 2 of the diff
181 164 </> 182 165 ); 183 166 } 167 168 169 170 // import * as Yup from 'yup'; changed this line in version 2 of the diff
5 5 import AppWelcome from "./app-welcome"; 6 6 import CaracterStunar from "./caracters-stuanr"; 7 7 import { BookingIllustration, MotivationIllustration } from "@/shared/assets/illustrations"; 8 import { useContext } from "react"; 9 import { AuthContext } from "@/contexts/auth/jwt/auth-context"; 8 10 9 11 10 12 export default function UserHome() 11 13 { 14 const { user} = useContext(AuthContext); 12 15 const settings = useSettingsContext(); 13 const { user } = useMockedUser(); 16 // const { user } = useMockedUser(); 31 31 NEXT_PUBLIC_SUPABASE_URL= 32 32 NEXT_PUBLIC_SUPABASE_ANON_KEY= 33 33 34 NEXT_PUBLIC_BACKEND_USERSERVICE_USER_API=http://localhost:8082/api/v1/users 34 NEXT_PUBLIC_BACKEND_USERSERVICE_USER_API=http://localhost:8082/auth/signup better to add only http://localhost:8082 as base url and any other servers (/auth/signup for example) add them in services paths definitions in a centralized constants file (you can add it in the same folder as your http client definition such as Axios)
added 9 commits
- 9b02ec5a - reslove conflicts 2
- 1c1e1dbe - remove unecessary code
- 60c320fd - remove unecessary code
- 114e1464 - reslove conflicts 3
- af49261f - remove unecessary code
- 62b112af - resolve conflict
- b9f9028c - resolve build problems
- ca24235c - resolve build problems
- d5e9c7e6 - resolve conflict and change the path
Afficher/masquer la liste des validationsadded 13 commits
-
d5e9c7e6...9777986e - 10 commits from branch
develop
- 348c5bfa - resolve conflicts
- d62d7bf5 - reslove conflicts 2
- 58461516 - resolve conlicts
Afficher/masquer la liste des validations-
d5e9c7e6...9777986e - 10 commits from branch
Veuillez vous inscrire ou vous connecter pour répondre