Skip to content
Snippets Groups Projects
Commit d41a1ba8 authored by Alexey Lunin's avatar Alexey Lunin
Browse files

Refactor identityPullAvatarFromGravatar with async await

parent e904107b
Branches
Tags
1 merge request!22Modify usage of Gravatar
......@@ -610,35 +610,34 @@ const connection = Penpal.connectToParent({
return responseToClient;
},
identityPullAvatarFromGravatar() {
return new Penpal.Promise(result => {
const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
if (authenticationPublicKey === null) {
result({"data" : "",
"code" : "400",
"status" : "Identity not authenticated"
})
}
if (window.loadedIdentities[authenticationPublicKey] === null) {
result({"data" : "",
"code" : "400",
"status" : "Identity not authenticated"
})
identityPullAvatarFromGravatar: async () => {
const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
if (authenticationPublicKey === null) {
return {
data : "",
code : "400",
status : "Identity not authenticated"
};
}
if (window.loadedIdentities[authenticationPublicKey] === null) {
return {
data : "",
code : "400",
status : "Identity not authenticated"
}
}
var success = extendPinCodeTtl(authenticationPublicKey);
var success = extendPinCodeTtl(authenticationPublicKey);
if(success === false) {
result({"data" : "",
"code" : "400",
"status" : "Identity not authenticated"
})
}
if(success === false) {
return {
data : "",
code : "400",
status : "Identity not authenticated"
};
}
executeRestfulFunction("private", viamApi, viamApi.identityPullAvatarFromGravatar).then(executeResult => {
result(executeResult);
});
});
return await executeRestfulFunction("private", viamApi, viamApi.identityPullAvatarFromGravatar);
},
identityAddNewDevice() {
return new Penpal.Promise(result => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment