Skip to content

Conversation

@mennthor
Copy link
Contributor

Start route for internal area is now /login.
No proper credential handling is included, only mockup.
On successful login, internal landing area is shown.
User can got to new shop registration or shop management for existing shops from there.

methods: {
login() {
// Routes to internal area if login successful
if(this.input.username != '' && this.input.password != '') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POST to /api/login using ajax and check return code (200 = authenticated, 401 not authenticated).
It also provides info what the reason for the denial is (wrong_credentials or a missing_role.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import JQuery from 'jquery'
JQuery.ajax(
    '/api/login',
    {
         method: "POST",
         data: {username: this.username, password: this.password},
         success: () => {handle sucess case here},
         error: (response) => {handle error case here}
    }
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants