Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CaCaoCritics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Bilel El Yaagoubi
CaCaoCritics
Commits
dd76a87b
Commit
dd76a87b
authored
3 years ago
by
Juliette Kalflèche
Browse files
Options
Downloads
Patches
Plain Diff
connection page
parent
a5ef887c
No related branches found
No related tags found
1 merge request
!24
connection page
Pipeline
#42649
passed with warnings
3 years ago
Stage: lint
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/components/Connexion.vue
+83
-0
83 additions, 0 deletions
frontend/src/components/Connexion.vue
frontend/src/views/Connexion.vue
+25
-13
25 additions, 13 deletions
frontend/src/views/Connexion.vue
with
108 additions
and
13 deletions
frontend/src/components/Connexion.vue
0 → 100644
+
83
−
0
View file @
dd76a87b
<
template
>
<h1
class=
"add-user-title"
>
Connexion
</h1>
<div
class=
"add-user-form-container"
>
<form
ref=
"addUserForm"
>
<input
class=
"add-user-input"
v-model=
"user.email"
type=
"email"
placeholder=
"Email"
required
/>
<input
class=
"add-user-input"
v-model=
"user.firstName"
placeholder=
"Password"
/>
</form>
<button
class=
"add-user-button"
@
click=
"addUser()"
>
Connexion
</button>
<div
v-if=
"userCreationError"
>
{{
userCreationError
}}
</div>
</div>
</
template
>
<
script
>
import
axios
from
"
axios
"
;
export
default
{
name
:
"
AddUser
"
,
emits
:
[
"
userAdded
"
],
data
:
function
()
{
return
{
user
:
{
email
:
""
,
firstName
:
""
,
lastName
:
""
,
},
userCreationError
:
""
,
};
},
methods
:
{
addUser
:
function
()
{
if
(
!
this
.
$refs
.
addUserForm
.
checkValidity
())
{
this
.
$refs
.
addUserForm
.
reportValidity
();
return
;
}
axios
.
post
(
`
${
process
.
env
.
VUE_APP_BACKEND_BASE_URL
}
/users/new`
,
this
.
user
)
.
then
(()
=>
{
this
.
$emit
(
"
userAdded
"
);
this
.
user
=
{
email
:
""
,
firstName
:
""
,
lastName
:
""
,
};
})
.
catch
((
error
)
=>
{
this
.
userCreationError
=
"
An error occured while creating new user.
"
;
console
.
error
(
error
);
});
},
},
};
</
script
>
<
style
scoped
>
.add-user-title
{
margin-bottom
:
10px
;
}
.add-user-form-container
{
display
:
flex
;
margin-bottom
:
20px
;
}
.add-user-input
{
margin-right
:
10px
;
padding
:
5px
;
}
.add-user-button
{
cursor
:
pointer
;
padding
:
5px
;
}
</
style
>
This diff is collapsed.
Click to expand it.
frontend/src/views/Connexion.vue
+
25
−
13
View file @
dd76a87b
<
template
>
<
template
>
<h1>
This is a Connexion example
</h1>
<AddUser
@
userAdded=
"fetchUsers()"
/>
<div
class=
"Connexion-value"
>
Connexion value is:
{{
Connexion
}}
</div>
<div
v-if=
"usersLoadingError"
>
{{
usersLoadingError
}}
</div>
<button
@
click=
"increment()"
>
Increment
</button>
</
template
>
</
template
>
<
script
>
<
script
>
// @ is an alias to /src
import
AddUser
from
"
@/components/Connexion.vue
"
;
import
axios
from
"
axios
"
;
export
default
{
export
default
{
name
:
"
Connexion
"
,
name
:
"
Users
"
,
components
:
{
AddUser
,
},
data
:
function
()
{
data
:
function
()
{
return
{
return
{
Connexion
:
0
,
users
:
[],
usersLoadingError
:
""
,
};
};
},
},
methods
:
{
methods
:
{
increment
:
function
()
{
fetchUsers
:
function
()
{
this
.
Connexion
++
;
axios
.
get
(
`
${
process
.
env
.
VUE_APP_BACKEND_BASE_URL
}
/users`
)
.
then
((
response
)
=>
{
this
.
users
=
response
.
data
.
users
;
})
.
catch
((
error
)
=>
{
this
.
usersLoadingError
=
"
An error occured while fetching users.
"
;
console
.
error
(
error
);
});
},
},
},
},
mounted
:
function
()
{
this
.
fetchUsers
();
},
};
};
</
script
>
</
script
>
<
style
scoped
>
.Connexion-value
{
margin-bottom
:
5px
;
}
</
style
>
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