chore: fix user request cache
This commit is contained in:
parent
745902e8b1
commit
85ed0202d8
1 changed files with 7 additions and 5 deletions
|
|
@ -23,11 +23,13 @@ const useUserV1Store = create<UserV1Store>()((set, get) => ({
|
||||||
return await requestCache.get(username);
|
return await requestCache.get(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
const promise = userServiceClient.getUser({
|
const promisedUser = userServiceClient
|
||||||
username: username,
|
.getUser({
|
||||||
});
|
username: username,
|
||||||
requestCache.set(username, promise);
|
})
|
||||||
const { user } = await promise;
|
.then(({ user }) => user);
|
||||||
|
requestCache.set(username, promisedUser);
|
||||||
|
const user = await promisedUser;
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new Error("User not found");
|
throw new Error("User not found");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue