Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97327

I get a SyntaxError when I type 'npm run serve'. The error is: Unexpected token, expected "," (45:2). What am I doing wrong?

$
0
0

I get a SyntaxError when I type: npm run serve

The error is: Unexpected token, expected "," (45:2)

What am I doing wrong?

I am working with Pusher and Vue.js in Visual-Studio-Code.

This is a Tutorial from a Website : https://www.sitepoint.com/pusher-vue-real-time-chat-app/

Below is my Code. Please help me guys!!

<template>
  <div class="login-form">
    <h5 class="text-center">Chat Login</h5>
    <hr>
    <b-form @submit.prevent="onSubmit">
       <b-alert variant="danger" :show="hasError">{{ error }} </b-alert>

      <b-form-group id="userInputGroup"
                    label="User Name"
                    label-for="userInput">
        <b-form-input id="userInput"
                      type="text"
                      placeholder="Enter user name"
                      v-model="userId"
                      autocomplete="off"
                      :disabled="loading"
                      required>
        </b-form-input>
      </b-form-group>

      <b-button type="submit"
                variant="primary"
                class="ld-ext-right"
                v-bind:class="{ running: loading }"
                :disabled="isValid">
                Login <div class="ld ld-ring ld-spin"></div>
      </b-button>
    </b-form>
  </div>
</template>

// something after .env


<script>
import { mapState, mapGetters, mapActions } from 'vuex'

export default {
  name: 'login-form',
  data() {
    return {
      userId: '',
    }
  }
  methods: {
    ...mapActions ([
      'login'
    ]),
    async onSubmit() {
      const result = await this.login(this.userId);
      if(result) {
        this.$router.push('chat');
      }
    }
  }
  computed : {
    isValid: function(){
      const result = this.userId.length < 3;
      return result ? result : this.loading
    },
    ...mapState([
      'loading''error'      
    ]),
    ...mapGetters([
      'hasError'
    ])
  }
}

</script>

Viewing all articles
Browse latest Browse all 97327

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>