Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
agetic
sitio-firebase
Commits
0a1d0923
Commit
0a1d0923
authored
Mar 18, 2020
by
Adrian
Browse files
cambios
parent
00272c6c
Changes
1
Show whitespace changes
Inline
Side-by-side
frontend/index.html
View file @
0a1d0923
...
@@ -6,18 +6,25 @@
...
@@ -6,18 +6,25 @@
<title>
.:: Sitio ::.
</title>
<title>
.:: Sitio ::.
</title>
<link
rel=
"stylesheet"
href=
"./style.css"
>
<link
rel=
"stylesheet"
href=
"./style.css"
>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
url
=
'
http://localhost:5000
/send
'
;
var
baseURL
=
'
http://localhost:5000
'
;
function
login
()
{
function
login
()
{
if
(
document
.
getElementById
(
'
user
'
).
value
===
'
admin
'
&&
document
.
getElementById
(
'
password
'
).
value
===
'
123456
'
)
{
service
(
baseURL
+
'
/login
'
,
{
usuario
:
document
.
getElementById
(
'
user
'
).
value
,
password
:
document
.
getElementById
(
'
password
'
).
value
})
.
then
((
data
)
=>
{
if
(
data
.
finalizado
)
{
window
.
localStorage
.
setItem
(
'
site_token
'
,
data
.
datos
.
token
);
document
.
getElementById
(
'
login
'
).
style
.
display
=
'
none
'
;
document
.
getElementById
(
'
login
'
).
style
.
display
=
'
none
'
;
document
.
getElementById
(
'
data
'
).
style
.
display
=
'
block
'
;
document
.
getElementById
(
'
data
'
).
style
.
display
=
'
block
'
;
}
else
{
}
else
{
alert
(
'
Datos incorrectos
'
);
alert
(
'
Datos incorrectos
'
);
}
}
});
}
}
async
function
postData
(
url
=
''
,
data
=
{})
{
async
function
service
(
url
=
''
,
data
=
{}
,
method
=
'
POST
'
)
{
const
response
=
await
fetch
(
url
,
{
const
response
=
await
fetch
(
url
,
{
method
:
'
POST
'
,
method
:
method
,
mode
:
'
cors
'
,
mode
:
'
cors
'
,
cache
:
'
no-cache
'
,
cache
:
'
no-cache
'
,
credentials
:
'
same-origin
'
,
credentials
:
'
same-origin
'
,
...
@@ -31,7 +38,7 @@
...
@@ -31,7 +38,7 @@
return
await
response
.
json
();
return
await
response
.
json
();
}
}
function
sendData
()
{
function
sendData
()
{
postData
(
url
,
{
service
(
baseURL
+
'
/send
'
,
{
titulo
:
document
.
querySelector
(
'
#title
'
).
value
,
titulo
:
document
.
querySelector
(
'
#title
'
).
value
,
text
:
document
.
querySelector
(
'
#description
'
).
value
text
:
document
.
querySelector
(
'
#description
'
).
value
})
})
...
...
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