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
c0628ef9
Commit
c0628ef9
authored
Nov 22, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: migrate create user
parent
c0b5070e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
MemberSection.tsx
web/src/components/Settings/MemberSection.tsx
+10
-8
api.ts
web/src/helpers/api.ts
+0
-4
No files found.
web/src/components/Settings/MemberSection.tsx
View file @
c0628ef9
import
{
Button
,
Dropdown
,
Input
,
Menu
,
MenuButton
}
from
"@mui/joy"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
userServiceClient
}
from
"@/grpcweb"
;
import
*
as
api
from
"@/helpers/api"
;
import
{
useUserStore
}
from
"@/store/module"
;
import
{
UserNamePrefix
}
from
"@/store/v1"
;
import
{
User_Role
}
from
"@/types/proto/api/v2/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showChangeMemberPasswordDialog
from
"../ChangeMemberPasswordDialog"
;
import
{
showCommonDialog
}
from
"../Dialog/CommonDialog"
;
...
...
@@ -53,16 +55,16 @@ const MemberSection = () => {
return
;
}
const
userCreate
:
UserCreate
=
{
username
:
state
.
createUserUsername
,
password
:
state
.
createUserPassword
,
role
:
"USER"
,
};
try
{
await
api
.
createUser
(
userCreate
);
await
userServiceClient
.
createUser
({
user
:
{
name
:
`
${
UserNamePrefix
}${
state
.
createUserUsername
}
`
,
password
:
state
.
createUserPassword
,
role
:
User_Role
.
USER
,
},
});
}
catch
(
error
:
any
)
{
toast
.
error
(
error
.
response
.
data
.
message
);
toast
.
error
(
error
.
details
);
}
await
fetchUserList
();
setState
({
...
...
web/src/helpers/api.ts
View file @
c0628ef9
...
...
@@ -44,10 +44,6 @@ export function signout() {
return
axios
.
post
(
"/api/v1/auth/signout"
);
}
export
function
createUser
(
userCreate
:
UserCreate
)
{
return
axios
.
post
<
User
>
(
"/api/v1/user"
,
userCreate
);
}
export
function
getMyselfUser
()
{
return
axios
.
get
<
User
>
(
"/api/v1/user/me"
);
}
...
...
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