Last active
August 6, 2021 11:36
-
-
Save percybolmer/964a82ccac9b7af61bc5caab0603325d to your computer and use it in GitHub Desktop.
A function that wraps our gRPC request and adds metadata for JWT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function GetUser(client, callback) { | |
var user = JSON.parse(localStorage.getItem('user')); | |
var userRequest = new UserRequest(); | |
if (user !== null) { | |
userRequest.setId(user.id); | |
var metadata = { "x-user-auth-token": user.token, "x-user-auth-id": user.id, } | |
client.getUser(userRequest, metadata, callback); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment