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 Scrum Team 02
Frontend
Commits
541fceb8
Commit
541fceb8
authored
1 year ago
by
Ingrid Martinsheimen Egge
Browse files
Options
Downloads
Patches
Plain Diff
man kan slette account
parent
52ae287e
No related branches found
No related tags found
1 merge request
!21
Merge profilinnstillinger into main
Pipeline
#221431
failed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/EditAccount.vue
+10
-2
10 additions, 2 deletions
src/components/EditAccount.vue
src/util/API.js
+12
-6
12 additions, 6 deletions
src/util/API.js
with
22 additions
and
8 deletions
src/components/EditAccount.vue
+
10
−
2
View file @
541fceb8
...
...
@@ -95,8 +95,16 @@ export default {
alert
(
"
Du må bekrefte at du vil slette konto ved å huke av boksen
"
)
}
else
{
alert
(
"
(Denne knappen gjør ingen ting) men account deleted
"
)
API
.
deleteAccount
(
this
.
user
.
id
,
token
);
const
id
=
this
.
user
.
id
;
API
.
deleteAccount
(
id
).
then
((
savedUser
)
=>
{
useAuthStore
().
setUser
(
savedUser
);
alert
(
"
Bruker oppdatert.
"
)
}).
catch
((
error
)
=>
{
alert
(
"
Det oppsto en feil ved sletting av bruker
"
)
console
.
log
(
error
)
})
}
},
}
...
...
This diff is collapsed.
Click to expand it.
src/util/API.js
+
12
−
6
View file @
541fceb8
...
...
@@ -110,15 +110,21 @@ export const API = {
* @param token
* @returns {Promise<*>}
*/
deleteAccount
:
async
(
id
,
token
)
=>
{
return
axios
.
delete
(
`
${
import
.
meta
.
env
.
VITE_BACKEND_URL
}
/account/{id}`
,
{
headers
:
{
Authorization
:
`Bearer
${
token
}
`
},
deleteAccount
:
async
(
id
)
=>
{
const
authStore
=
useAuthStore
();
if
(
!
authStore
.
isLoggedIn
)
{
throw
new
Error
();
}
return
axios
.
delete
(
`
${
import
.
meta
.
env
.
VITE_BACKEND_URL
}
/account/
${
id
}
`
,
{
headers
:
{
Authorization
:
`Bearer
${
authStore
.
token
}
`
},
})
.
then
((
response
)
=>
{
return
response
.
data
;
.
then
(()
=>
{
authStore
.
logout
()
router
.
push
(
'
/login
'
)
})
.
catch
(()
=>
{
throw
new
Error
(
"
Account not found or not accessible
"
);
throw
new
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