Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
externe Matthieu
Géocontrib Frontend
Commits
1024ff05
Commit
1024ff05
authored
3 years ago
by
Sébastien DA ROCHA
Browse files
Options
Downloads
Plain Diff
Merge branch 'ticket/11714' into 'develop'
add error in user store See merge request
geocontrib/geocontrib-frontend!13
parents
c9b6bcc3
0749df73
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/store/index.js
+14
-2
14 additions, 2 deletions
src/store/index.js
src/views/registration/Login.vue
+12
-2
12 additions, 2 deletions
src/views/registration/Login.vue
with
26 additions
and
4 deletions
src/store/index.js
+
14
−
2
View file @
1024ff05
...
...
@@ -30,6 +30,7 @@ export default new Vuex.Store({
map
},
state
:
{
error
:
null
,
logged
:
false
,
user
:
false
,
configuration
:
null
,
...
...
@@ -43,6 +44,9 @@ export default new Vuex.Store({
},
mutations
:
{
error
(
state
,
data
)
{
return
state
.
error
=
data
},
SET_PROJECTS
(
state
,
projects
)
{
state
.
projects
=
projects
;
},
...
...
@@ -125,15 +129,23 @@ export default new Vuex.Store({
password
:
payload
.
password
,
})
.
then
((
response
)
=>
{
commit
(
'
error
'
,
null
)
if
(
response
&&
response
.
status
===
200
)
{
// * use stored previous route to go back after login if page not open on login at first
const
routerHistory
=
router
.
options
.
routerHistory
[
0
].
name
!==
"
login
"
?
router
.
options
.
routerHistory
:
"
/
"
let
routerHistory
=
''
if
(
router
.
options
.
routerHistory
[
0
]
!=
undefined
){
routerHistory
=
router
.
options
.
routerHistory
[
0
].
name
!==
"
login
"
?
router
.
options
.
routerHistory
:
"
/
"
}
else
{
routerHistory
=
"
/
"
}
commit
(
"
SET_USER
"
,
response
.
data
.
user
);
router
.
push
(
routerHistory
[
routerHistory
.
length
-
1
]
||
"
/
"
)
dispatch
(
"
GET_USER_LEVEL_PROJECTS
"
);
}
})
.
catch
(()
=>
{
.
catch
((
error
)
=>
{
if
(
error
.
response
.
status
===
403
)
commit
(
'
error
'
,
error
.
response
.
data
.
detail
)
commit
(
"
SET_USER
"
,
false
);
});
}
...
...
This diff is collapsed.
Click to expand it.
src/views/registration/Login.vue
+
12
−
2
View file @
1024ff05
...
...
@@ -62,6 +62,7 @@
<
script
>
import
{
mapState
}
from
"
vuex
"
;
export
default
{
name
:
"
Login
"
,
...
...
@@ -76,6 +77,7 @@ export default {
};
},
computed
:
{
...
mapState
([
"
error
"
]),
LOGO_PATH
:
function
()
{
return
this
.
$store
.
state
.
configuration
.
VUE_APP_LOGO_PATH
;
},
...
...
@@ -87,11 +89,19 @@ export default {
},
},
methods
:
{
login
()
{
async
login
()
{
this
.
$store
.
dispatch
(
"
LOGIN
"
,
{
username
:
this
.
username_value
,
password
:
this
.
password_value
,
});
})
.
then
(()
=>
{
if
(
this
.
error
!=
null
){
this
.
form
.
errors
=
"
Les informations d'identification sont incorrectes.
"
;
}
})
.
catch
(()
=>
{
this
.
form
.
errors
=
this
.
error
});
},
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment