Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
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
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
idatt2106-2024-07
frontend
Merge requests
!50
feat: adding input for bank account
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
feat: adding input for bank account
BankInput
into
main
Overview
0
Commits
1
Pipelines
1
Changes
4
Merged
Viktor Gunnar Grevskott
requested to merge
BankInput
into
main
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
4
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
390f4877
1 commit,
1 year ago
4 files
+
184
−
70
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/views/Settings/SettingsAccountView.vue
+
44
−
18
Options
@@ -2,41 +2,67 @@
import
{
ref
,
onMounted
}
from
'
vue
'
;
import
BaseInput
from
'
@/components/InputFields/BaseInput.vue
'
;
import
{
useUserInfoStore
}
from
"
@/stores/UserStore
"
;
import
{
UserService
}
from
'
@/api
'
;
import
type
{
UserUpdateDTO
}
from
'
@/api
'
;
const
firstNameRef
=
ref
()
const
surnameRef
=
ref
(
''
)
const
emailRef
=
ref
(
''
)
const
passwordRef
=
ref
(
''
)
const
confirmPasswordRef
=
ref
(
''
)
const
formRef
=
ref
()
let
samePasswords
=
ref
(
true
)
const
handleFirstNameInputEvent
=
(
newValue
:
any
)
=>
{
firstNameRef
.
value
=
newValue
}
const
errorMsg
=
ref
(
''
)
const
confirmationMsg
=
ref
(
''
)
const
handleEmailInputEvent
=
(
newValue
:
any
)
=>
{
emailRef
.
value
=
newValue
}
async
function
setupForm
()
{
try
{
let
response
=
await
UserService
.
getUser
();
if
(
response
.
email
!=
null
)
{
emailRef
.
value
=
response
.
email
}
confirmationMsg
.
value
=
''
;
errorMsg
.
value
=
''
;
}
catch
(
err
)
{
errorMsg
.
value
=
'
Error fetching email, try again!
'
confirmationMsg
.
value
=
''
}
}
const
handleSubmit
=
async
()
=>
{
console
.
log
(
'
Yoooo
'
)
const
updateUserPayload
:
UserUpdateDTO
=
{
email
:
emailRef
.
value
,
};
try
{
UserService
.
update
({
requestBody
:
updateUserPayload
})
useUserInfoStore
().
setUserInfo
({
email
:
emailRef
.
value
,
})
confirmationMsg
.
value
=
'
Email updated successfully!
'
errorMsg
.
value
=
''
;
}
catch
(
err
)
{
errorMsg
.
value
=
"
Error updating email, try again!
"
;
confirmationMsg
.
value
=
''
}
}
onMounted
(()
=>
{
setupForm
()
})
</
script
>
<
template
>
<div
class=
"tab-pane active"
id=
"account"
>
<h6>
ACCOUNT SETTINGS
</h6>
<hr>
<form>
<div
class=
"form-group"
>
<BaseInput
:model-value=
"firstNameRef"
@
input-change-event=
"handleFirstNameInputEvent"
id=
"firstNameInputChange"
input-id=
"first-name-new"
type=
"text"
label=
"Username"
placeholder=
"Enter your username"
invalid-message=
"Please enter your username"
/>
</div>
<br>
<form
@
submit.prevent=
"handleSubmit"
>
<div
class=
"form-group"
>
<BaseInput
:model-value=
"emailRef"
@
input-change-event=
"handleEmailInputEvent"
id=
"emailInput-change"
input-id=
"email-new"
type=
"email"
label=
"Email"
placeholder=
"Enter your email"
invalid-message=
"Invalid email"
/>
invalid-message=
"Invalid email"
/>
</div>
<p
class=
"text-danger"
>
{{
errorMsg
}}
</p>
<p
class=
"text-success"
>
{{
confirmationMsg
}}
</p>
<br>
<button
type=
"submit"
class=
"btn btn-primary"
>
Update Profile
</button>
<hr>
<div
class=
"form-group"
>
<label
class=
"d-block text-danger"
>
Delete Account
</label>
Loading