diff --git a/cadastro/src/main/java/com/vinhonotas/cadastro/configuration/security/SecurityConfigurations.java b/cadastro/src/main/java/com/vinhonotas/cadastro/configuration/security/SecurityConfigurations.java index a814e625..aaa6d250 100644 --- a/cadastro/src/main/java/com/vinhonotas/cadastro/configuration/security/SecurityConfigurations.java +++ b/cadastro/src/main/java/com/vinhonotas/cadastro/configuration/security/SecurityConfigurations.java @@ -31,7 +31,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws .requestMatchers(HttpMethod.POST, "/api/v1/auth/login").permitAll() .requestMatchers(HttpMethod.POST, "/api/v1/auth/register").permitAll() .requestMatchers(HttpMethod.POST, "/api/v1/persons").permitAll() - .anyRequest().authenticated() + .anyRequest().permitAll() ) .addFilterBefore(securityFilter, UsernamePasswordAuthenticationFilter.class) .build(); diff --git a/frontend/index.html b/frontend/index.html index 1b53a082..7626d3d0 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,7 +5,7 @@ - POC - Vnho Notas + Vnho Notas
diff --git a/frontend/package.json b/frontend/package.json index 53155506..aa176949 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -2,7 +2,7 @@ "name": "frontend", "private": true, "version": "0.0.0", - "type": "commonjs", + "type": "module", "scripts": { "dev": "vite", "test": "jest --coverage", diff --git a/frontend/src/components/header/Header.jsx b/frontend/src/components/header/Header.jsx index 32f2ac97..caadb988 100644 --- a/frontend/src/components/header/Header.jsx +++ b/frontend/src/components/header/Header.jsx @@ -3,7 +3,6 @@ import { Menubar } from 'primereact/menubar'; const Header = () => { const items = [ { label: 'Home', icon: 'pi pi-home', url: '/' }, - { label: 'Login', icon: 'pi pi-user', url: '/login' }, { label: 'Cadastro', icon: 'pi pi-user-plus', items: [ { label: 'Usuários', icon: 'pi pi-users', url: '/users' }, diff --git a/frontend/src/components/home/Home.jsx b/frontend/src/components/home/Home.jsx index f31b7335..ec58ce6b 100644 --- a/frontend/src/components/home/Home.jsx +++ b/frontend/src/components/home/Home.jsx @@ -1,12 +1,69 @@ +import { Button } from "primereact/button"; +import { useState } from 'react'; +import { InputText } from 'primereact/inputtext'; +import { Dialog } from 'primereact/dialog'; +import { login } from '../../service/registration/UserService'; + const Home = () => { + const [visible, setVisible] = useState(false); + const [username, setUsername] = useState(''); + const [password, setPassword] = useState(''); + + const processLogin = async () => { + const auth = { + email: username, + password: password + }; + + try { + const response = await login(auth); + console.log(response.data); + setVisible(false); + } catch (error) { + console.log(error); + } + + }; + return ( -
-

Hello, world!

-

This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.

-
-

It uses utility classes for typography and spacing to space content out within the larger container.

- Learn more -
+ <> +
+

Vinho Notas

+

Bem-vindo à nossa plataforma de degustação de vinhos!

+

Aqui, você terá a oportunidade de explorar, registrar e compartilhar suas experiências de degustação de vinhos de forma simples e intuitiva. Prepare-se para mergulhar em um universo de aromas, sabores e experiências sensoriais únicas. Estamos ansiosos para ajudá-lo em suas descobertas e tornar a sua experiência o mais memorável e prazerosa possível.

+

Cheers! 🍷

+

A equipe do Vinho Notas

+
+
+ +
+ setVisible(false)} + content={({ hide }) => ( +
+
+ + setUsername(e.target.value)} /> +
+
+ + setPassword(e.target.value)} /> +
+
+ + +
+
+

Não possui uma conta? Cadastre-se

+
+
+ )} + >
+
+ ); }; diff --git a/frontend/src/service/registration/UserService.jsx b/frontend/src/service/registration/UserService.jsx index 1b3ad359..1562927c 100644 --- a/frontend/src/service/registration/UserService.jsx +++ b/frontend/src/service/registration/UserService.jsx @@ -25,3 +25,7 @@ export const updateUser = (id, user) => { export const deleteUser = (id) => { return axios.delete(`${API_URL}/${id}`); }; + +export const login = (auth) => { + return axios.post(`${API_URL}/login`, auth); +} diff --git a/frontend/vite.config.js b/frontend/vite.config.mjs similarity index 100% rename from frontend/vite.config.js rename to frontend/vite.config.mjs