palla451
1 year ago

laravel + vue.js The page has expired due to inactivity. Please refresh and try again.

Posted 1 year ago by palla451

Hello guys, i have e simple example of crud in laravel with vue.js, but when i insert a new user i have the messagge 'The page has expired due to inactivity. Please refresh and try again. '. I create the record but don't redirect...

Add New user

            <div class="form-group">
                <label class="control-label col-sm-2" for="name">Name:</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="name" aria-describedby="name" placeholder="Enter name" v-model="name">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-2" for="email">Email:</label>
                <div class="col-sm-10">
                  <input type="text" class="form-control" id="email" placeholder="email" v-model="email">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-2" for="password">Password:</label>
                <div class="col-sm-10">
                    <input type="password" class="form-control" id="password" placeholder="password" v-model="password">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default" v-on:click='addNewUser()'>Submit</button>
                </div>
            </div>
        </form>
</div>

export default {
    data() {
        return {

            name: '',
            email: '',
            password: ''
        }
    },
    methods: {
        addNewUser() {
            console.log(this.name)
            console.log(this.email)
            console.log(this.password)

            // passing the data to API

            axios.post('/api/users',{
                name: this.name,
                email: this.email,
                password: this.password
            }).then(response=>{
                console.log(response),
                this.name='',
                this.email='',
                this.password=''
            })
                .catch(error=>{console.log(error)})
            }
        }
}

Please sign in or create an account to participate in this conversation.