Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-j 51
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-j 51
22_23-j 51
Commits
08f3bf51
Commit
08f3bf51
authored
Feb 03, 2023
by
Hasith Yoman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login page added
parent
0c9a75d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
137 additions
and
0 deletions
+137
-0
frontend/Screens/Login.js
frontend/Screens/Login.js
+137
-0
No files found.
frontend/Screens/Login.js
0 → 100644
View file @
08f3bf51
import
{
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
Image
,
TextInput
,
}
from
"
react-native
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
FancyAlert
}
from
"
react-native-expo-fancy-alerts
"
;
export
default
function
Login
({
navigation
})
{
const
[
email
,
setEmail
]
=
useState
(
"
admin@gt.com
"
);
const
[
password
,
setPassword
]
=
useState
(
"
123
"
);
const
[
visible
,
setVisible
]
=
React
.
useState
(
false
);
const
signIn
=
()
=>
{
const
requestOptions
=
{
method
:
"
POST
"
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
},
body
:
JSON
.
stringify
({
email
:
email
,
password
:
password
}),
};
fetch
(
"
https://fuel.udarax.me/api/user/login
"
,
requestOptions
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
data
)
=>
{
console
.
log
(
data
);
if
(
data
[
"
status
"
]
==
"
success
"
)
{
navigation
.
navigate
(
"
Dashboard
"
,
{
user_id
:
data
[
"
user
"
],
role
:
data
[
"
role
"
],
});
}
else
{
setVisible
(
true
);
alert
(
"
Login Faild. Please check your email and password!
"
);
}
});
};
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
containersub
}
>
<
Image
style
=
{
styles
.
tinyLogo
}
source
=
{
require
(
"
../assets/logo.png
"
)}
/
>
<
/View
>
<
Text
style
=
{
styles
.
title
}
>
Gas
Tracker
<
/Text
>
<
Text
style
=
{
styles
.
subtitle
}
>
The
easiest
way
to
manage
fuel
distribution
in
your
area
.
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
onChangeText
=
{
setEmail
}
value
=
{
email
}
placeholder
=
"
Enter Email
"
/>
<
TextInput
style
=
{
styles
.
input
}
onChangeText
=
{
setPassword
}
value
=
{
password
}
placeholder
=
"
Enter Password
"
/>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{
signIn
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Sign
In
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{[
styles
.
button
,{
backgroundColor
:
"
#f05a36
"
}]}
onPress
=
{()
=>
navigation
.
navigate
(
"
RegisterUser
"
)}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Don
’
t
have
an
account
?
Sign
up
<
/Text
>
<
/TouchableOpacity
>
{
/* <FancyAlert
visible={visible}
icon={
<View
style={{
flex: 1,
display: "flex",
justifyContent: "center",
alignItems: "center",
backgroundColor: "red",
borderRadius: 50,
width: "100%",
}}
>
<Text>🤓</Text>
</View>
}
style={{ backgroundColor: "white" }}
>
<Text style={{ marginTop: -16, marginBottom: 32 }}>Hello there</Text>
</FancyAlert> */
}
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
padding
:
20
,
flex
:
1
,
justifyContent
:
"
center
"
,
},
containersub
:
{
alignItems
:
"
center
"
,
},
tinyLogo
:
{
width
:
100
,
height
:
120
,
},
title
:
{
marginTop
:
20
,
fontWeight
:
"
700
"
,
fontSize
:
30
,
color
:
"
#560cce
"
,
textAlign
:
"
center
"
,
},
subtitle
:
{
textAlign
:
"
center
"
,
marginTop
:
20
,
fontSize
:
16
,
},
input
:
{
height
:
45
,
marginHorizontal
:
12
,
marginTop
:
20
,
borderWidth
:
1
,
padding
:
10
,
borderRadius
:
5
,
},
button
:
{
alignItems
:
"
center
"
,
backgroundColor
:
"
#560cce
"
,
marginHorizontal
:
12
,
marginTop
:
20
,
height
:
45
,
borderRadius
:
5
,
justifyContent
:
"
center
"
,
},
buttonText
:
{
color
:
"
#fff
"
,
},
});
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