Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DBMS inventory manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shrey Patel
DBMS inventory manager
Commits
f20cd49a
Commit
f20cd49a
authored
1 year ago
by
Shrey Patel
Browse files
Options
Downloads
Patches
Plain Diff
fully fixed auth
parent
e243302c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inventory-manager/src/components/user/AccountInformation.jsx
+16
-17
16 additions, 17 deletions
inventory-manager/src/components/user/AccountInformation.jsx
src/main/java/com/example/accessingdatamysql/MainController.java
+1
-0
1 addition, 0 deletions
...n/java/com/example/accessingdatamysql/MainController.java
with
17 additions
and
17 deletions
inventory-manager/src/components/user/AccountInformation.jsx
+
16
−
17
View file @
f20cd49a
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
Axios
from
"
axios
"
;
import
Axios
from
"
axios
"
;
import
PropTypes
from
"
prop-types
"
;
import
PropTypes
from
"
prop-types
"
;
import
'
./AccountInformation.css
'
;
// Import your external CSS file
import
"
./AccountInformation.css
"
;
// Import your external CSS file
const
AccountInformation
=
({
token
})
=>
{
const
AccountInformation
=
({
token
})
=>
{
const
[
userInfo
,
setUserInfo
]
=
useState
({
const
[
userInfo
,
setUserInfo
]
=
useState
({
...
@@ -21,10 +21,10 @@ const AccountInformation = ({ token }) => {
...
@@ -21,10 +21,10 @@ const AccountInformation = ({ token }) => {
const
getUserInfo
=
async
()
=>
{
const
getUserInfo
=
async
()
=>
{
try
{
try
{
cons
t
response
=
await
Axios
.
post
(
cons
ole
.
log
(
token
);
"
http://localhost:8080/user/user
"
,
const
response
=
await
Axios
.
post
(
"
http://localhost:8080/user/user
"
,
{
{
jwt
:
token
.
jwt
}
jwt
:
token
.
jwt
,
);
}
);
setUserInfo
(
response
.
data
);
setUserInfo
(
response
.
data
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
"
Error fetching user information:
"
,
error
);
console
.
error
(
"
Error fetching user information:
"
,
error
);
...
@@ -33,17 +33,14 @@ const AccountInformation = ({ token }) => {
...
@@ -33,17 +33,14 @@ const AccountInformation = ({ token }) => {
const
handleUpdate
=
async
()
=>
{
const
handleUpdate
=
async
()
=>
{
try
{
try
{
const
response
=
await
Axios
.
put
(
const
response
=
await
Axios
.
put
(
"
http://localhost:8080/user/update
"
,
{
"
http://localhost:8080/user/update
"
,
fname
:
userInfo
.
fname
,
{
lname
:
userInfo
.
lname
,
fname
:
userInfo
.
fname
,
password
:
userInfo
.
password
,
lname
:
userInfo
.
lname
,
phoneNumber
:
userInfo
.
phoneNumber
,
password
:
userInfo
.
password
,
email
:
userInfo
.
email
,
phoneNumber
:
userInfo
.
phoneNumber
,
jwt
:
token
.
jwt
,
email
:
userInfo
.
email
,
});
jwt
:
token
.
jwt
,
}
);
setUserInfo
(
response
.
data
);
setUserInfo
(
response
.
data
);
setUpdateSuccess
(
true
);
setUpdateSuccess
(
true
);
console
.
log
(
"
User information updated successfully
"
);
console
.
log
(
"
User information updated successfully
"
);
...
@@ -63,7 +60,9 @@ const AccountInformation = ({ token }) => {
...
@@ -63,7 +60,9 @@ const AccountInformation = ({ token }) => {
return
(
return
(
<
div
className
=
"account-info-container"
>
<
div
className
=
"account-info-container"
>
<
h2
>
Account Information
</
h2
>
<
h2
>
Account Information
</
h2
>
{
updateSuccess
&&
<
p
className
=
"success-message"
>
Information updated successfully!
</
p
>
}
{
updateSuccess
&&
(
<
p
className
=
"success-message"
>
Information updated successfully!
</
p
>
)
}
<
div
className
=
"info-form"
>
<
div
className
=
"info-form"
>
<
label
htmlFor
=
"fname"
>
First Name
</
label
>
<
label
htmlFor
=
"fname"
>
First Name
</
label
>
<
input
<
input
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/example/accessingdatamysql/MainController.java
+
1
−
0
View file @
f20cd49a
...
@@ -74,6 +74,7 @@ public class MainController {
...
@@ -74,6 +74,7 @@ public class MainController {
found
.
setEmail
(
"failed"
);
found
.
setEmail
(
"failed"
);
return
found
;
return
found
;
}
}
System
.
out
.
println
(
res
.
get
(
"user"
));
Optional
<
User
>
usr
=
userRepository
.
findById
(
res
.
get
(
"user"
));
Optional
<
User
>
usr
=
userRepository
.
findById
(
res
.
get
(
"user"
));
if
(!
usr
.
isPresent
())
if
(!
usr
.
isPresent
())
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment