Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
partido-interdimensional-pirata
lumi
la web de miniloom
Commits
240e9835
Commit
240e9835
authored
Apr 20, 2019
by
Your Name
Browse files
Un monton de cosas ;/
parent
4ef704f6
Changes
11
Hide whitespace changes
Inline
Side-by-side
.env
0 → 100644
View file @
240e9835
VUE_APP_API_URL=https://loom.lainventoria.com.ar
pnpm-lock.yaml
0 → 100644
View file @
240e9835
devDependencies
:
vue-svg-loader
:
0.12.0
vue-template-compiler
:
2.6.10
lockfileVersion
:
5
packages
:
/@types/q/1.5.2
:
dev
:
true
resolution
:
integrity
:
sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==
/ansi-styles/3.2.1
:
dependencies
:
color-convert
:
1.9.3
dev
:
true
engines
:
node
:
'
>=4'
resolution
:
integrity
:
sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
/argparse/1.0.10
:
dependencies
:
sprintf-js
:
1.0.3
dev
:
true
resolution
:
integrity
:
sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
/big.js/5.2.2
:
dev
:
true
resolution
:
integrity
:
sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==
/boolbase/1.0.0
:
dev
:
true
resolution
:
integrity
:
sha1-aN/1++YMUes3cl6p4+0xDcwed24=
/chalk/2.4.2
:
dependencies
:
ansi-styles
:
3.2.1
escape-string-regexp
:
1.0.5
supports-color
:
5.5.0
dev
:
true
engines
:
node
:
'
>=4'
resolution
:
integrity
:
sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
/coa/2.0.2
:
dependencies
:
'
@types/q'
:
1.5.2
chalk
:
2.4.2
q
:
1.5.1
dev
:
true
engines
:
node
:
'
>=
4.0'
resolution
:
integrity
:
sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA==
/color-convert/1.9.3
:
dependencies
:
color-name
:
1.1.3
dev
:
true
resolution
:
integrity
:
sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
/color-name/1.1.3
:
dev
:
true
resolution
:
integrity
:
sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
/css-select-base-adapter/0.1.1
:
dev
:
true
resolution
:
integrity
:
sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==
/css-select/2.0.2
:
dependencies
:
boolbase
:
1.0.0
css-what
:
2.1.3
domutils
:
1.7.0
nth-check
:
1.0.2
dev
:
true
resolution
:
integrity
:
sha512-dSpYaDVoWaELjvZ3mS6IKZM/y2PMPa/XYoEfYNZePL4U/XgyxZNroHEHReDx/d+VgXh9VbCTtFqLkFbmeqeaRQ==
/css-tree/1.0.0-alpha.28
:
dependencies
:
mdn-data
:
1.1.4
source-map
:
0.5.7
dev
:
true
engines
:
node
:
'
>=0.10.0'
resolution
:
integrity
:
sha512-joNNW1gCp3qFFzj4St6zk+Wh/NBv0vM5YbEreZk0SD4S23S+1xBKb6cLDg2uj4P4k/GUMlIm6cKIDqIG+vdt0w==
/css-tree/1.0.0-alpha.29
:
dependencies
:
mdn-data
:
1.1.4
source-map
:
0.5.7
dev
:
true
engines
:
node
:
'
>=0.10.0'
resolution
:
integrity
:
sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg==
/css-url-regex/1.1.0
:
dev
:
true
resolution
:
integrity
:
sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w=
/css-what/2.1.3
:
dev
:
true
resolution
:
integrity
:
sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==
/csso/3.5.1
:
dependencies
:
css-tree
:
1.0.0-alpha.29
dev
:
true
engines
:
node
:
'
>=0.10.0'
resolution
:
integrity
:
sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg==
/de-indent/1.0.2
:
dev
:
true
resolution
:
integrity
:
sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=
/define-properties/1.1.3
:
dependencies
:
object-keys
:
1.1.1
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==
/dom-serializer/0.1.1
:
dependencies
:
domelementtype
:
1.3.1
entities
:
1.1.2
dev
:
true
resolution
:
integrity
:
sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==
/domelementtype/1.3.1
:
dev
:
true
resolution
:
integrity
:
sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==
/domutils/1.7.0
:
dependencies
:
dom-serializer
:
0.1.1
domelementtype
:
1.3.1
dev
:
true
resolution
:
integrity
:
sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==
/emojis-list/2.1.0
:
dev
:
true
engines
:
node
:
'
>=
0.10'
resolution
:
integrity
:
sha1-TapNnbAPmBmIDHn6RXrlsJof04k=
/entities/1.1.2
:
dev
:
true
resolution
:
integrity
:
sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==
/es-abstract/1.13.0
:
dependencies
:
es-to-primitive
:
1.2.0
function-bind
:
1.1.1
has
:
1.0.3
is-callable
:
1.1.4
is-regex
:
1.0.4
object-keys
:
1.1.1
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==
/es-to-primitive/1.2.0
:
dependencies
:
is-callable
:
1.1.4
is-date-object
:
1.0.1
is-symbol
:
1.0.2
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==
/escape-string-regexp/1.0.5
:
dev
:
true
engines
:
node
:
'
>=0.8.0'
resolution
:
integrity
:
sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
/esprima/4.0.1
:
dev
:
true
engines
:
node
:
'
>=4'
hasBin
:
true
resolution
:
integrity
:
sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
/function-bind/1.1.1
:
dev
:
true
resolution
:
integrity
:
sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
/has-flag/3.0.0
:
dev
:
true
engines
:
node
:
'
>=4'
resolution
:
integrity
:
sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
/has-symbols/1.0.0
:
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=
/has/1.0.3
:
dependencies
:
function-bind
:
1.1.1
dev
:
true
engines
:
node
:
'
>=
0.4.0'
resolution
:
integrity
:
sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
/he/1.2.0
:
dev
:
true
hasBin
:
true
resolution
:
integrity
:
sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
/is-callable/1.1.4
:
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==
/is-date-object/1.0.1
:
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=
/is-regex/1.0.4
:
dependencies
:
has
:
1.0.3
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=
/is-symbol/1.0.2
:
dependencies
:
has-symbols
:
1.0.0
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==
/js-yaml/3.13.1
:
dependencies
:
argparse
:
1.0.10
esprima
:
4.0.1
dev
:
true
hasBin
:
true
resolution
:
integrity
:
sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
/json5/1.0.1
:
dependencies
:
minimist
:
1.2.0
dev
:
true
hasBin
:
true
resolution
:
integrity
:
sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
/loader-utils/1.2.3
:
dependencies
:
big.js
:
5.2.2
emojis-list
:
2.1.0
json5
:
1.0.1
dev
:
true
engines
:
node
:
'
>=4.0.0'
resolution
:
integrity
:
sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==
/mdn-data/1.1.4
:
dev
:
true
resolution
:
integrity
:
sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA==
/minimist/0.0.8
:
dev
:
true
resolution
:
integrity
:
sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=
/minimist/1.2.0
:
dev
:
true
resolution
:
integrity
:
sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=
/mkdirp/0.5.1
:
dependencies
:
minimist
:
0.0.8
dev
:
true
hasBin
:
true
resolution
:
integrity
:
sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=
/nth-check/1.0.2
:
dependencies
:
boolbase
:
1.0.0
dev
:
true
resolution
:
integrity
:
sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==
/object-keys/1.1.1
:
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
/object.getownpropertydescriptors/2.0.3
:
dependencies
:
define-properties
:
1.1.3
es-abstract
:
1.13.0
dev
:
true
engines
:
node
:
'
>=
0.8'
resolution
:
integrity
:
sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=
/object.values/1.1.0
:
dependencies
:
define-properties
:
1.1.3
es-abstract
:
1.13.0
function-bind
:
1.1.1
has
:
1.0.3
dev
:
true
engines
:
node
:
'
>=
0.4'
resolution
:
integrity
:
sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg==
/q/1.5.1
:
dev
:
true
engines
:
node
:
'
>=0.6.0'
teleport
:
'
>=0.2.0'
resolution
:
integrity
:
sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
/sax/1.2.4
:
dev
:
true
resolution
:
integrity
:
sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
/source-map/0.5.7
:
dev
:
true
engines
:
node
:
'
>=0.10.0'
resolution
:
integrity
:
sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
/sprintf-js/1.0.3
:
dev
:
true
resolution
:
integrity
:
sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
/stable/0.1.8
:
dev
:
true
resolution
:
integrity
:
sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==
/supports-color/5.5.0
:
dependencies
:
has-flag
:
3.0.0
dev
:
true
engines
:
node
:
'
>=4'
resolution
:
integrity
:
sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
/svg-to-vue/0.4.0
:
dependencies
:
svgo
:
1.2.2
dev
:
true
peerDependencies
:
vue-template-compiler
:
^2.0.0
resolution
:
integrity
:
sha512-g/ZHtEFf4QDsDtTk9tuYX/MJ2HESTUBMTkuLoffQGQ3xMtlmD9Ec4YyTgmMkP1P8QJtWWu2FiGdOnlKaXc/X/Q==
/svgo/1.2.2
:
dependencies
:
chalk
:
2.4.2
coa
:
2.0.2
css-select
:
2.0.2
css-select-base-adapter
:
0.1.1
css-tree
:
1.0.0-alpha.28
css-url-regex
:
1.1.0
csso
:
3.5.1
js-yaml
:
3.13.1
mkdirp
:
0.5.1
object.values
:
1.1.0
sax
:
1.2.4
stable
:
0.1.8
unquote
:
1.1.1
util.promisify
:
1.0.0
dev
:
true
engines
:
node
:
'
>=4.0.0'
hasBin
:
true
resolution
:
integrity
:
sha512-rAfulcwp2D9jjdGu+0CuqlrAUin6bBWrpoqXWwKDZZZJfXcUXQSxLJOFJCQCSA0x0pP2U0TxSlJu2ROq5Bq6qA==
/unquote/1.1.1
:
dev
:
true
resolution
:
integrity
:
sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=
/util.promisify/1.0.0
:
dependencies
:
define-properties
:
1.1.3
object.getownpropertydescriptors
:
2.0.3
dev
:
true
resolution
:
integrity
:
sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==
/vue-svg-loader/0.12.0
:
dependencies
:
loader-utils
:
1.2.3
svg-to-vue
:
0.4.0
dev
:
true
resolution
:
integrity
:
sha512-pg8H6iKCj+DAC7FZuxdfGJMHiFpJPv/YyoN1M7Iqlf+Hu4eU6Q/W/sEFx978syQA+aOx0NXrp+uQUAajqQvXbQ==
/vue-template-compiler/2.6.10
:
dependencies
:
de-indent
:
1.0.2
he
:
1.2.0
dev
:
true
resolution
:
integrity
:
sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg==
specifiers
:
vue-svg-loader
:
^0.12.0
vue-template-compiler
:
^2.6.10
src/App.vue
View file @
240e9835
<
template
>
<div
id=
"app"
>
<div
id=
"nav"
>
<router-link
to=
"/"
>
Home
</router-link>
</div>
<Nav
/>
<div
class=
"view-container"
>
<router-view
/>
</div>
<footer>
<p>
Copyleft
<CopyleftIcon
/>
Partido Interdimensional Pirata
</p>
<p>
<a
target=
"_blank"
href=
"https://0xacab.org/partido-interdimensional-pirata/miniloom"
>
Código
</a>
licenciado bajo
<a
target=
"_blank"
href=
"https://www.gnu.org/licenses/agpl-3.0.txt"
>
AGPL-3.0
</a>
</p>
</footer>
</div>
</
template
>
<
script
>
import
Nav
from
'
@/components/Nav
'
import
CopyleftIcon
from
'
@/components/CopyleftIcon
'
export
default
{
name
:
'
App
'
,
components
:
{
Nav
,
CopyleftIcon
},
}
</
script
>
<
style
lang=
"scss"
>
:root
{
--background
:
#EEEEEE
;
...
...
@@ -53,6 +69,11 @@ button {
margin
:
10px
;
font-family
:
inherit
;
display
:
inline-flex
;
user-select
:
none
;
justify-content
:
center
;
align-items
:
center
;
&
.primary
{
background
:
var
(
--
accent
);
color
:
var
(
--
background
);
...
...
src/components/Button.vue
0 → 100644
View file @
240e9835
<
template
>
<button
:class=
"
{ 'loading': loading }">
<slot></slot>
</button>
</
template
>
<
script
>
export
default
{
name
:
'
custom-button
'
,
props
:
[
'
loading
'
],
}
</
script
>
<
style
lang=
"scss"
scoped
>
button
{
transition
:
color
.25s
;
}
.loading
{
color
:
transparent
;
pointer-events
:
none
;
}
button
:after
{
opacity
:
0
;
transition
:
opacity
.25s
;
}
.loading
:after
{
// position
position
:
absolute
;
margin-left
:
.25em
;
display
:
block
;
opacity
:
1
;
// actual spinner
border
:
3px
solid
var
(
--
foreground
);
border-top-left
:
none
;
border-radius
:
290486px
;
border-color
:
transparent
transparent
#fff
#fff
!
important
;
animation
:
spinAround
.5s
infinite
linear
;
content
:
''
;
width
:
1em
;
height
:
1em
;
}
@keyframes
spinAround
{
from
{
transform
:
rotate
(
0
)
}
to
{
transform
:
rotate
(
359deg
)
}
}
</
style
>
src/components/CopyleftIcon.vue
0 → 100644
View file @
240e9835
<
template
>
<span
class=
"copyleft"
>
©
</span>
</
template
>
<
style
scoped
>
.copyleft
{
transform
:
rotateY
(
180deg
);
display
:
inline-block
;
}
</
style
>
src/components/Field.vue
View file @
240e9835
...
...
@@ -9,7 +9,7 @@
width
:
100%
;
text-align
:
left
;
max-width
:
450px
;
margin
:
0
auto
;
margin
:
15px
auto
;
label
{
display
:
block
;
}
...
...
src/components/Nav.vue
0 → 100644
View file @
240e9835
<
template
>
<div
id=
"nav"
>
<router-link
to=
"/"
>
Home
</router-link>
|
<span
v-if=
"loggedIn"
>
Iniciada sesión.
<a
href=
"javascript:"
@
click.prevent=
"$store.dispatch('logOut')"
>
Cerrar sesión
</a>
</span>
<router-link
v-else
to=
"/iniciarSesion"
>
Iniciar sesión
</router-link>
</div>
</
template
>
<
script
>
import
{
mapState
}
from
'
vuex
'
export
default
{
name
:
'
Nav
'
,
computed
:
{
...
mapState
([
'
loggedIn
'
,
'
profile
'
]),
},
}
</
script
>
src/router.js
View file @
240e9835
...
...
@@ -2,6 +2,7 @@ import Vue from 'vue'
import
Router
from
'
vue-router
'
import
Home
from
'
./views/Home.vue
'
import
CrearCuenta
from
'
./views/CrearCuenta.vue
'
import
IniciarSesion
from
'
./views/IniciarSesion.vue
'
import
NotFound
from
'
./views/NotFound.vue
'
Vue
.
use
(
Router
)
...
...
@@ -18,6 +19,11 @@ export default new Router({
name
:
'
crear cuenta
'
,
component
:
CrearCuenta
,
},
{
path
:
'
/iniciarSesion
'
,
name
:
'
iniciar sesion
'
,
component
:
IniciarSesion
,
},
{
path
:
'
*
'
,
name
:
'
not found
'
,
...
...
src/store.js
View file @
240e9835
...
...
@@ -3,14 +3,73 @@ import Vuex from 'vuex'
Vue
.
use
(
Vuex
)
export
default
new
Vuex
.
Store
({
state
:
{
const
API_URL
=
process
.
env
.
VUE_APP_API_URL
const
generateToken
=
()
=>
btoa
(
localStorage
.
email
+
'
:
'
+
localStorage
.
password
)
const
request
=
(
path
,
{
json
,
authenticated
=
true
,
...
args
})
=>
fetch
(
API_URL
+
path
,
{
...
args
,
headers
:
{
...(
json
?
{
'
Content-Type
'
:
'
application/json
'
}
:
{}),
...(
authenticated
?
{
'
Authorization
'
:
`Basic
${
generateToken
()}
`
}
:
{}),
...
args
.
headers
,
},
mutations
:
{
...(
json
?
{
body
:
JSON
.
stringify
(
json
),
}
:
{}),
})
const
store
=
new
Vuex
.
Store
({
state
:
{
loggedIn
:
false
,
profile
:
null
,
},
mutations
:
{
loggedIn
:
state
=>
state
.
loggedIn
=
true
,
loggedOut
:
state
=>
{
state
.
loggedIn
=
false
state
.
profile
=
null
},
gotProfile
:
(
state
,
profile
)
=>
state
.
profile
=
profile
,
},
actions
:
{
async
loggedIn
({
commit
},
{
email
,
password
})
{
localStorage
.
email
=
email
localStorage
.
password
=
password
commit
(
'
loggedIn
'
)
},
async
logOut
({
commit
})
{
localStorage
.
email
=
null
localStorage
.
password
=
null
commit
(
'
loggedOut
'
)
},
crearCuenta
({
commit
,
dispatch
},
userData
)
{
return
request
(
'
/piratas
'
,
{
method
:
'
POST
'
,
json
:
{
pirata
:
userData
},
authenticated
:
false
,
})
.
then
(
res
=>
res
.
json
())
.
then
(
json
=>
{
if
(
json
.
errors
)
{
return
Promise
.
reject
(
json
.
errors
)
}
}
commit
(
'
gotProfile
'
,
json
)
dispatch
(
'
loggedIn
'
,
email
,
password
)
return
json