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
ppl-fasilkom-ui
2020
PPL-C
PPTI-Mobile Apps Monitoring Wabah Tuberkolosis
Neza-Mobile
Commits
fff55625
Commit
fff55625
authored
Apr 09, 2020
by
Irwanto
Browse files
Pbi 2 login: fix signup error
parent
85a8b133
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/scenes/LoginPage/index.tsx
View file @
fff55625
...
...
@@ -5,9 +5,11 @@ import styled from 'styled-components/native';
import
{
Button
,
Text
,
Field
}
from
'
components
'
;
import
{
useFormState
}
from
'
helpers
'
;
import
{
LocalStorage
}
from
'
services
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
const
LoginPage
=
()
=>
{
const
navigation
=
useNavigation
();
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
)
const
[
isFirstTime
,
setIsFirstTime
]
=
useState
(
true
)
const
{
vh
,
setToken
,
services
}
=
useContext
(
AppContext
);
...
...
src/scenes/OfficerSignupForm/index.tsx
View file @
fff55625
...
...
@@ -190,7 +190,8 @@ const OfficerSignupForm = () => {
})
if
(
response
.
status
===
201
)
{
navigation
.
navigate
(
"
officer-signup-finish
"
)
setIsLoading
(
false
);
navigation
.
navigate
(
"
officer-signup-finish
"
);
}
else
if
(
response
.
status
===
500
)
{
if
(
response
.
data
.
includes
(
"
IntegrityError
"
))
{
setServerHasError
(
false
);
...
...
@@ -200,8 +201,8 @@ const OfficerSignupForm = () => {
setModalVisible
(
true
);
}
}
setIsLoading
(
false
)
setIsChecked
(
true
)
setIsLoading
(
false
)
;
setIsChecked
(
true
)
;
}
}
>
Ajukan Akun
</
Button
>
...
...
src/services/hooks/useMainService/index.tsx
View file @
fff55625
...
...
@@ -4,13 +4,13 @@ import { API_MAIN_URL } from 'react-native-dotenv';
const
END_POINTS
=
{
SIGNUP
:
'
/signup
'
,
ME
:
'
/accounts/me
'
,
ME
:
'
/accounts/me/
'
,
ACCOUNT
:
'
/accounts/
'
,
CREATE_CASE_SUBJECT
:
"
cases/case-subjects
"
,
CREATE_INVESTIGATION_CASE
:
"
/cases/investigation-cases
"
,
GET_LOG
:
"
/logs
"
,
LIST_POSITIVE_CASE
:
"
/cases/positive-cases
"
,
LOGIN
:
'
/auth/token/
'
,
ACCOUNT
:
createEndpoint
([
"
accounts
"
]),
};
enum
Method
{
...
...
@@ -87,10 +87,7 @@ export default function useMainService(token: string) {
}
async
function
me
()
{
const
endpoint
=
END_POINTS
.
ACCOUNT
([
"
me
"
])
return
fetchWithAuthentication
(
endpoint
,
Method
.
GET
)
return
fetchWithAuthentication
(
END_POINTS
.
ME
,
Method
.
GET
);
}
interface
UserFormType
{
...
...
@@ -103,11 +100,7 @@ export default function useMainService(token: string) {
}
async
function
createUser
(
body
:
UserFormType
)
{
const
endpoint
=
END_POINTS
.
ACCOUNT
([
null
,
])
return
fetchWithoutAuthentication
(
endpoint
,
Method
.
POST
,
body
);
return
fetchWithoutAuthentication
(
END_POINTS
.
ACCOUNT
,
Method
.
POST
,
body
);
}
async
function
createCaseSubject
(
body
:
object
)
{
...
...
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