Skip to content
Open

Chat #37

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
0bcd22d
Update Project
molro Jan 31, 2022
55444a9
Estructura del proyecto
molro Jan 31, 2022
513d798
Enlaces
molro Jan 31, 2022
240d691
Upd
molro Jan 31, 2022
90d3e69
Rutas creadas & Requirimientos en Readme
molro Feb 1, 2022
6ed1eb3
Updated Gitingore
molro Feb 1, 2022
8faa7a4
Endpoint Users finalizado (N1Ex1)
molro Feb 1, 2022
6fbce31
Nivell 1 - Exercise 2
molro Feb 2, 2022
87abc46
Update README.md
molro Feb 10, 2022
2bd9500
Update readme
molro Feb 10, 2022
791e695
Updrdm
molro Feb 10, 2022
3895ab0
Update README.md
molro Feb 14, 2022
004a3a3
Update Package.json
molro Feb 14, 2022
97d97da
Merge branch 'sprint41' of https://github.com/molivaresr/nodeInitialD…
molro Feb 14, 2022
072ef4a
uploads
molro Feb 14, 2022
bbd0672
uploads
molro Feb 14, 2022
74aca88
Niveles 1 al 3
molro Mar 7, 2022
44faa8d
Chat - Server (running)
molro Mar 9, 2022
20e8d96
Diseño de Login
molro Mar 10, 2022
4b51e57
Front v2
molro Mar 13, 2022
198d773
Front V2.3 / Back Socket conectado
molro Mar 14, 2022
aca8707
Upd Repo
molro Mar 15, 2022
7f25485
Login test
molro Mar 15, 2022
d3e8f18
Merge branch 'chat' of https://github.com/molro/nodeInitialDemo into …
molro Mar 15, 2022
da9dadf
Servidor + Orden de Front
molro Mar 15, 2022
9e40e11
Reorganización
molro Mar 16, 2022
7094628
TS Client Working
molro Mar 17, 2022
061dba9
Reorganización
molro Mar 17, 2022
0a243b5
Eliminando
molro Mar 17, 2022
7fc8899
useRef solucionap
molro Mar 17, 2022
c6512a4
Git Ignore updated
molro Mar 17, 2022
0782c12
gitignore
molro Mar 19, 2022
aed7618
Inicio de sesion
molro Mar 19, 2022
e7d6f41
icloud
molro Mar 19, 2022
6bb721e
Creando salas
molro Mar 20, 2022
8e63661
Pendiente de inicializar en NEXT
molro Mar 21, 2022
63da478
Renderizando Rooms
molro Mar 21, 2022
81fe9bb
Recibiendo salas del server!
molro Mar 22, 2022
206543e
Merge branch 'chat' of https://github.com/molro/nodeInitialDemo into …
molro Mar 23, 2022
a44be00
Leyendo Rooms desde el server
molro Mar 23, 2022
53febcd
Casi Casi
molro Mar 24, 2022
633304b
Renderizado OK! - PTE REFACTORIZAR FUNCION
molro Mar 27, 2022
fd2beca
Refactor y Maquetación
molro Mar 28, 2022
6c221a5
Server
molro Mar 28, 2022
f5dacfe
Front
molro Mar 29, 2022
8aed4b9
Utilizando Context
molro Mar 29, 2022
3b38a35
Mensajes
molro Mar 30, 2022
0bfc182
Create login.css
molro Mar 30, 2022
13a82e7
NewSockets
molro Mar 31, 2022
cd5ce10
Merge branch 'chat' of https://github.com/molro/nodeInitialDemo into …
molro Mar 31, 2022
85f8406
Front Working
molro Mar 31, 2022
bee8666
Mensajes y error detectado.
molro Apr 3, 2022
f17b2fd
Persistencia Mongo
molro Apr 4, 2022
eee7d87
Server / Rutas / Persistencia
molro Apr 5, 2022
abba654
TokensAdvance
molro Apr 6, 2022
e0b8bad
Limpiando Importaciones
molro Apr 6, 2022
dd939cf
Testeando JWT y limpiando rutas
molro Apr 6, 2022
90c2d8e
Token. Pendiente validar
molro Apr 7, 2022
a487e42
Validaciones y persistencia
molro Apr 10, 2022
39cfd0c
Login OK
molro Apr 11, 2022
d648a77
Persistencia Mensajes y Salas
molro Apr 13, 2022
9f5a31a
Features 80%
molro Apr 15, 2022
f69c884
Detalles
molro Apr 16, 2022
1b29de1
Login
molro Apr 19, 2022
289aee6
Login / rutas
molro Apr 19, 2022
2b157d4
Casi Login
molro Apr 20, 2022
b5f5994
Login
molro Apr 21, 2022
9968b11
Login Ok! Rutas, Registro
molro Apr 21, 2022
41e8883
Registro Pulido
molro Apr 21, 2022
1d150a4
Debugging sockets
molro Apr 22, 2022
5b11085
Perfilando
molro Apr 23, 2022
bc243a8
Solución de Errores
molro Apr 25, 2022
70715b7
Upd
molro Apr 25, 2022
c6dcd24
Pendiente Obtener Listado de usuarios
molro Apr 25, 2022
7b21344
Listados!
molro Apr 26, 2022
1a04ef9
Cleaning Repo
molro Apr 26, 2022
072731a
Recibiendo Usuarios
molro Apr 26, 2022
2a737fb
Estilos
molro Apr 27, 2022
b5c0795
Update readme.md
molro Apr 27, 2022
0a24eb4
Update readme.md
molro Apr 27, 2022
302f34b
Update readme.md
molro Apr 27, 2022
3649a72
Update readme.md
molro Apr 27, 2022
eb01c3d
Update readme.md
molro Apr 27, 2022
1421342
Update readme.md
molro Apr 27, 2022
9a5b1b9
entrega final
molro Apr 27, 2022
87daca7
Merge branch 'chat' of https://github.com/molro/nodeInitialDemo into …
molro Apr 27, 2022
536d176
Update readme.md
molro Apr 27, 2022
af16d10
Update readme.md
molro Apr 27, 2022
37209bf
Update readme.md
molro Apr 27, 2022
6d93a53
Update readme.md
molro Apr 27, 2022
1471504
Update readme.md
molro Apr 27, 2022
eaeb5d8
Update readme.md
molro Apr 27, 2022
8712779
Update readme.md
molro Apr 27, 2022
bd665a4
Entrega final
molro Apr 27, 2022
35c9bef
Merge branch 'chat' of https://github.com/molro/nodeInitialDemo into …
molro Apr 27, 2022
0349583
title
molro Apr 27, 2022
2c197b6
titulo
molro Apr 27, 2022
8ecf052
Corregido Error
molro May 2, 2022
9ddfa42
Cambios Menores
molro May 2, 2022
f237eb8
Login fixed
molro May 2, 2022
7962a2e
Mejorando Usuarios
molro May 2, 2022
1b9ac4d
Cambios Finales
molro May 3, 2022
5d8d8a8
Corrección de errores
molro May 5, 2022
0969cac
Update readme.md
molro Oct 27, 2022
4ebdc2f
Update readme.md
molro Oct 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules/

##MacOs
.DS_Store
.DS_Store
.icloud
7 changes: 0 additions & 7 deletions Enlaces.md

This file was deleted.

50 changes: 0 additions & 50 deletions README.md

This file was deleted.

13 changes: 0 additions & 13 deletions cmds/create.js

This file was deleted.

3 changes: 0 additions & 3 deletions cmds/delete.js

This file was deleted.

3 changes: 0 additions & 3 deletions cmds/findBy.js

This file was deleted.

3 changes: 0 additions & 3 deletions cmds/help.js

This file was deleted.

3 changes: 0 additions & 3 deletions cmds/show.js

This file was deleted.

3 changes: 0 additions & 3 deletions cmds/update.js

This file was deleted.

38 changes: 0 additions & 38 deletions createTest.js

This file was deleted.

66 changes: 0 additions & 66 deletions index.js

This file was deleted.

13 changes: 0 additions & 13 deletions inquirerTest.js

This file was deleted.

23 changes: 23 additions & 0 deletions itchat/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
36 changes: 36 additions & 0 deletions itchat/Otros/AuthContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, {useState} from 'react';
import fakeAuthProvider from '../services/auth'
import useLogin from '../hooks/useLogin';

const AuthContext = React.createContext({});

export function useAuth() {
return React.useContext(AuthContext);
}

export default function AuthProvider({ children }) {
const [jwt, setJWT] = useState(
() => window.localStorage.getItem('jwt')
)
const [nickname, setNickname] = useState(
() => window.localStorage.getItem('nickname')
)

let signin = (newUser, callback) => {
return fakeAuthProvider.signin(() => {
setJWT(newUser);
callback();
});
};

let signout = (callback) => {
return fakeAuthProvider.signout(() => {
setJWT(null);
callback();
});
};

let value = { jwt, nickname, setNickname, setJWT, signin, signout};

return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
}
22 changes: 22 additions & 0 deletions itchat/Otros/AuthStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

export default function AuthStatus() {
let auth = useAuth();
let navigate = useNavigate();

if (!auth.user) {
return <p>You are not logged in.</p>;
}

return (
<p>
Welcome {auth.user}!{" "}
<button
onClick={() => {
auth.signout(() => navigate("/"));
}}
>
Sign out
</button>
</p>
);
}
51 changes: 51 additions & 0 deletions itchat/Otros/Login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useEffect, useRef} from "react";
import {Navigate, useLocation, useNavigate} from 'react-router-dom';
import useLogin from '../hooks/useLogin'
import '../styles/Login_Style.css'

export default function Login({onLogin}) {
const location = useLocation();
const navigate = useNavigate();
const {isLoginLoading, hasLoginError, login, isLogged, } = useLogin();
const userRef = useRef(null);
const passRef = useRef(null);
let from = "/";
useEffect(() => {
if (isLogged) {
navigate('/')
onLogin && onLogin()
}
}, [isLogged, navigate, onLogin])

const handleSubmit = (e) => {
e.preventDefault();
const userValue = userRef.current.value
const passValue = passRef.current.value
login(userValue, passValue)

};

return (
<>
{isLoginLoading && <strong>Checking credentials...</strong>}
{!isLoginLoading &&
<form className='form' onSubmit={handleSubmit}>
<label>
email
<input className="login__input" placeholder="email" ref={userRef}/>
</label>

<label>
password
<input className="login__input" type="password" placeholder="password" ref={passRef}/>
</label>

<button className='login__button'>Login</button>
</form>
}
{
hasLoginError && <strong>Credentials are invalid</strong>
}
</>
);
}
Loading