Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

547
Views
Uncaught TypeError: Cannot convert undefined or null to object in vue js axios

I have an error that says

Uncaught TypeError: Cannot convert undefined or null to object

iIt's my first time in javascript. what's problem with this code?

<template>
    <div class="container my-5">
        <div class="row justify-content-center">
            <div class="col-5">
                <div class="card rounded shadow">
                    <div class="card-header">
                        <p>Login YukPilih App</p>
                    </div>
                    <div class="card-body">
                        <form @submit.prevent="userLogin()">
                          <div class="mb-3">
                            <label for="username" class="form-label">Username</label>
                            <input type="text" class="form-control" id="username" v-model="username">
                          </div>
                          <div class="mb-3">
                            <label for="password" class="form-label">Password</label>
                            <input type="password" class="form-control" id="password" v-model="password">
                          </div>
                          <button type="submit" class="btn btn-primary" name="login">Login</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import axios from 'axios'

    export default{
        data(){
            return{
                username: null,
                password: null
            }
        },

        methods: {
            userLogin: function(){
                axios.post('http://localhost:8000/api/auth/login',{
                    username: this.username,
                    password: this.password
                })
                .then(res => {
                    console.log(res)
                })
                .catch(err => {
                    console.log(err)
                })
            }
        }
    }
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!