Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
7a685d64
Commit
7a685d64
authored
Feb 20, 2025
by
johnnyjoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fetch user by username
parent
1ebe2e9a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
UserProfile.tsx
web/src/pages/UserProfile.tsx
+1
-1
user.ts
web/src/store/v2/user.ts
+14
-0
No files found.
web/src/pages/UserProfile.tsx
View file @
7a685d64
...
@@ -32,7 +32,7 @@ const UserProfile = () => {
...
@@ -32,7 +32,7 @@ const UserProfile = () => {
}
}
userStore
userStore
.
getOrFetchUserByN
ame
(
username
)
.
fetchUserByUsern
ame
(
username
)
.
then
((
user
)
=>
{
.
then
((
user
)
=>
{
setUser
(
user
);
setUser
(
user
);
loadingState
.
setFinish
();
loadingState
.
setFinish
();
...
...
web/src/store/v2/user.ts
View file @
7a685d64
...
@@ -40,6 +40,19 @@ const userStore = (() => {
...
@@ -40,6 +40,19 @@ const userStore = (() => {
return
user
;
return
user
;
};
};
const
fetchUserByUsername
=
async
(
username
:
string
)
=>
{
const
user
=
await
userServiceClient
.
getUser
({
name
:
username
,
});
state
.
setPartial
({
userMapByName
:
{
...
state
.
userMapByName
,
[
user
.
name
]:
user
,
},
});
return
user
;
};
const
getUserByName
=
(
name
:
string
)
=>
{
const
getUserByName
=
(
name
:
string
)
=>
{
return
state
.
userMapByName
[
name
];
return
state
.
userMapByName
[
name
];
};
};
...
@@ -128,6 +141,7 @@ const userStore = (() => {
...
@@ -128,6 +141,7 @@ const userStore = (() => {
return
{
return
{
state
,
state
,
getOrFetchUserByName
,
getOrFetchUserByName
,
fetchUserByUsername
,
getUserByName
,
getUserByName
,
fetchUsers
,
fetchUsers
,
updateUser
,
updateUser
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment