This commit is contained in:
Mustafa Buyukcelebi 2019-01-21 13:36:21 +03:00
parent cbe7f820d1
commit e7c7f39ce8

View File

@ -99,13 +99,14 @@ export const loginWithSC2 = async (code) => {
let avatar = '';
return new Promise((resolve, reject) => {
let jsonMetadata;
try {
const jsonMetadata = JSON.parse(account.account.json_metadata);
jsonMetadata = JSON.parse(account.account.json_metadata) || '';
if (Object.keys(jsonMetadata).length !== 0) {
avatar = jsonMetadata.profile.profile_image || '';
}
} catch (error) {
reject(new Error('auth.invalid_credentials'));
jsonMetadata = '';
}
const userData = {
username: account.account.name,