mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
simplify code
This commit is contained in:
parent
cb93fbcb72
commit
46b12f2bc2
1 changed files with 4 additions and 8 deletions
|
@ -26,11 +26,9 @@ const updateProfile = async (
|
||||||
_event: Electron.IpcMainInvokeEvent,
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
displayName: string,
|
displayName: string,
|
||||||
newProfileImagePath: string | null
|
newProfileImagePath: string | null
|
||||||
) => {
|
): Promise<UserProfile> => {
|
||||||
if (!newProfileImagePath) {
|
if (!newProfileImagePath) {
|
||||||
return patchUserProfile(displayName).then(
|
return patchUserProfile(displayName);
|
||||||
(response) => response as UserProfile
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const stats = fs.statSync(newProfileImagePath);
|
const stats = fs.statSync(newProfileImagePath);
|
||||||
|
@ -51,13 +49,11 @@ const updateProfile = async (
|
||||||
"Content-Type": mimeType?.mime,
|
"Content-Type": mimeType?.mime,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return profileImageUrl;
|
return profileImageUrl as string;
|
||||||
})
|
})
|
||||||
.catch(() => undefined);
|
.catch(() => undefined);
|
||||||
|
|
||||||
return patchUserProfile(displayName, profileImageUrl).then(
|
return patchUserProfile(displayName, profileImageUrl);
|
||||||
(response) => response as UserProfile
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
registerEvent("updateProfile", updateProfile);
|
registerEvent("updateProfile", updateProfile);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue