-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
agregar metodo getUserInfo #5
Conversation
Pull Request Test Coverage Report for Build 6737311536
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En el requerimiento especifica que la funcion se pueda usar fuera del contexto de react, exportar desde el index esta función para poder usarla independientemente
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dejé unos comentarios
src/utils/getUserInfo.js
Outdated
*/ | ||
export const getUserInfo = async () => { | ||
try { | ||
const getStorageTokens = await AsyncStorage.getItem(keys.OAUTH_TOKENS_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fijate que para hacer esto, ya hay una funcion que se llama getTokensCache. Nos va a servír usar la función ya que si por x motivo el día de mañana tenemos que cambiar las keys que guardamos en async storage, solo cambiemos la función y sigue todo ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corregido
src/utils/getUserInfo.js
Outdated
const getStorageTokens = await AsyncStorage.getItem(keys.OAUTH_TOKENS_KEY); | ||
const oauthTokens = parseJson(getStorageTokens) || {}; | ||
|
||
if (!Object.keys(oauthTokens).length) throw Error('cant get oauth tokens'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
acá te faltó crear una nueva instancia de la clase error (osea throw new Error('...'))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corregido
src/utils/getUserInfo.js
Outdated
|
||
const {idToken = ''} = oauthTokens; | ||
|
||
if (!idToken) throw Error('cant get id token'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en este caso lo mismo que lo de arriba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corregido
LINK DE TICKET:
https://janiscommerce.atlassian.net/browse/APPSRN-230
LINK DE SUBTAREA:
https://janiscommerce.atlassian.net/browse/APPSRN-234
DESCRIPCIÓN DEL REQUERIMIENTO:
Contexto
En muchos eventos necesitamos obtener info del usuario y hoy estamos todo usandolo por el pkg oauth. El problema de esto es que es un hook y en varias ocasiones necesitamos obtener la info fuera del contexto de react.
Necesidad
Dado que aun no tenemos en claro como vamos a encarar el uso de async storage, vamos a ir por el camino de tener un método que nos brinde la información del usuario sin depender si estamos en el contexto de la libreria o no.
"Se necesita tener un metodo por ejemplo getUserInfo que devuelva informacion de usuario para el uso de analyticis y crashlytics"
DESCRIPCIÓN DE LA SOLUCIÓN:
CÓMO SE PUEDE PROBAR?
SCREENSHOTS:
DATOS EXTRA A TENER EN CUENTA:
CHANGELOG:
El dev debera modificar el changelog ya con el pr.
Pasos para realizar por el dev encargado de ejecutar merge y push a master
Cambiar version en package.json
Guardar cambios
Ejecutar git tag -a v[version] -m "mensaje"
Ejecutar git push origin master --follow-tags