Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Functional Programming
Diskuy-Frontend
Commits
047aa413
Commit
047aa413
authored
Feb 22, 2021
by
Jonathan
Browse files
Merge branch 'jonathan' into 'master'
Jonathan See merge request
!31
parents
8977fd2b
3f12e3fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/components/profile/Profile.jsx
View file @
047aa413
...
...
@@ -74,7 +74,7 @@ export default function Profile(props) {
<
b
>
Your threads
</
b
>
)
}
{
username
!=
profileUsername
&&
(
<
b
>
{
user
.
username
}
s threads
</
b
>
<
b
>
{
user
.
username
}
'
s threads
</
b
>
)
}
</
h3
>
...
...
src/components/profile/UpdateProfileForm.jsx
View file @
047aa413
...
...
@@ -4,13 +4,14 @@ import { useInput } from '../../helpers/hooks/input-hook';
import
'
../../styles/profile/UpdateProfileForm.css
'
;
import
authHeader
from
'
../../helpers/services/authHeader.service
'
;
import
{
API_URL
}
from
'
../../config/keys
'
;
import
AuthService
from
'
../../helpers/services/auth.service
'
;
export
default
function
FormCreateThread
(
props
)
{
const
{
value
:
username
,
bind
:
bindUsername
,
reset
:
resetUsername
,
}
=
useInput
(
''
);
}
=
useInput
(
AuthService
.
getCurrentUsername
()
);
const
[
message
,
setMessage
]
=
useState
(
''
);
const
back
=
()
=>
{
...
...
src/helpers/services/auth.service.js
View file @
047aa413
...
...
@@ -2,31 +2,8 @@ import axios from 'axios';
import
{
API_URL
}
from
'
../../config/keys
'
;
class
AuthService
{
async
login
(
email
,
password
)
{
const
response
=
await
axios
.
post
(
`
${
API_URL
}
/users/signin`
,
{
email
,
password
,
});
if
(
response
?.
data
?.
token
)
localStorage
.
setItem
(
'
user
'
,
JSON
.
stringify
(
response
.
data
));
return
response
;
}
logout
()
{
localStorage
.
removeItem
(
'
user
'
);
localStorage
.
removeItem
(
'
callback
'
);
}
async
register
(
username
,
email
,
password
)
{
const
response
=
await
axios
.
post
(
`
${
API_URL
}
/users/signup`
,
{
user
:
{
username
,
email
,
password
,
},
});
await
this
.
login
(
email
,
password
);
return
response
;
}
getCurrentUser
()
{
...
...
Write
Preview
Supports
Markdown
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