diff --git a/src/client/pages/vault/vault.js b/src/client/pages/vault/vault.js index 8dc3ef6..d5b9ad4 100644 --- a/src/client/pages/vault/vault.js +++ b/src/client/pages/vault/vault.js @@ -27,15 +27,10 @@ document.addEventListener("DOMContentLoaded", async () => { } else { const user = JSON.parse(localStorage.getItem("user")); - const name = await api - .post("/users/name", { - email: session.identity, - deviceID: session.device, - }) - .then((res) => res.data) - .catch((err) => console.log(err)); - - localStorage.setItem("user", JSON.stringify({ ...user, name: name })); + localStorage.setItem( + "user", + JSON.stringify({ ...user, name: await getUserName() }) + ); } await checkUserStatus(); @@ -215,6 +210,16 @@ function checkUserStatus() { .catch((err) => console.log(err)); } +function getUserName() { + return api + .post("/users/name", { + email: session.identity, + deviceID: session.device, + }) + .then((res) => res.data) + .catch((err) => err); +} + function getUserKeychainUUIDs() { return api .post("/users/keychains", {