Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
idatt2106_2024_03_frontend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Scrum_Team_3
idatt2106_2024_03_frontend
Merge requests
!114
Code documentation views
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Code documentation views
code-documentation-views
into
master
Overview
0
Commits
5
Pipelines
1
Changes
7
Merged
Torbjørn Antonsen
requested to merge
code-documentation-views
into
master
10 months ago
Overview
0
Commits
5
Pipelines
1
Changes
7
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
e4db7d6d
5 commits,
10 months ago
7 files
+
149
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
src/views/FrontPage/LoginView.vue
+
13
−
0
Options
@@ -11,16 +11,29 @@ const username = ref('');
const
password
=
ref
(
''
);
const
toast
=
useToast
();
/**
* Navigates the user to the sign-up page using Vue Router.
* @returns This function does not return a value.
*/
function
navigateToNewUser
()
{
router
.
push
(
'
/signup
'
)
}
/**
* Checks if the user is an existing user based on token state and conditions.
* @returns True if the user is considered an existing user, false otherwise.
*/
const
existingUser
=
()
=>
{
return
(
useTokenStore
().
jwtToken
!==
''
&&
!
useTokenStore
().
jwtToken
.
includes
(
'
Request
'
)
&&
!
useTokenStore
().
jwtToken
.
includes
(
'
Error
'
))
}
/**
* Attempts to log in a user by retrieving a token and performing navigation based on login status.
* Shows appropriate toast messages based on different login outcomes.
* @returns A promise that resolves after login attempt and navigation are completed.
*/
async
function
login
()
{
await
useTokenStore
().
getTokenAndSaveInStore
(
username
.
value
,
password
.
value
);
Loading