Giter VIP home page Giter VIP logo

vue-vuex-registration-login-example's Introduction

vue-vuex-registration-login-example's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-vuex-registration-login-example's Issues

SyntaxError: Unexpected token ...

Hi,

I follow the setup instruction in this guide:
https://jasonwatmore.com/post/2018/07/14/vue-vuex-user-registration-and-login-tutorial-example

Steps:

  1. Install NodeJS and NPM from https://nodejs.org/en/download/.
  2. Download or clone the project source code from https://github.com/cornflourblue/vue-vuex-registration-login-example
  3. Install all required npm packages by running npm install from the command line in the project root folder (where the package.json is located).
  4. Start the application by running npm start from the command line in the project root folder, this will launch a browser displaying the application.

However, it throw errors when i perform npm start.

Error Logs:

jerry [19:56:32] [~/Desktop/GitHub/vue-vuex-registration-login-example] [dev *]
-> % npm start

> [email protected] start /Users/jerry/Desktop/GitHub/vue-vuex-registration-login-example
> webpack-dev-server --open

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /Users/jerry/Desktop/GitHub/vue-vuex-registration-login-example
ℹ 「wds」: 404s will fallback to /index.html
ℹ 「wdm」: wait until bundle finished: /
✖ 「wdm」: Hash: c99df25eb5d500d1418c
Version: webpack 4.41.2
Time: 1649ms
Built at: 05/11/2020 19:56:53
     Asset       Size  Chunks             Chunk Names
index.html  800 bytes          [emitted]  
   main.js    1.1 MiB    main  [emitted]  main
Entrypoint main = main.js
[0] multi (webpack)-dev-server/client?http://localhost:8080 ./src 40 bytes {main} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/vee-validate/dist/vee-validate.esm.js] 326 KiB {main} [built]
[./node_modules/vue/dist/vue.runtime.esm.js] 222 KiB {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 4.29 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {main} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./src/_helpers/index.js] 88 bytes {main} [built]
[./src/_store/index.js] 298 bytes {main} [built]
[./src/index.js] 362 bytes {main} [built]
    + 48 hidden modules

ERROR in ./src/app/App.vue (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app/App.vue)
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (20:8)

  18 |     name: 'app',
  19 |     computed: {
> 20 |         ...mapState({
     |         ^
  21 |             alert: state => state.alert
  22 |         })
  23 |     },

 @ ./src/app/App.vue 3:0-103 3:0-103 4:0-116 17:2-16
 @ ./src/index.js

ERROR in ./src/home/HomePage.vue (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/home/HomePage.vue)
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (27:8)

  25 | export default {
  26 |     computed: {
> 27 |         ...mapState({
     |         ^
  28 |             account: state => state.account,
  29 |             users: state => state.users.all
  30 |         })

 @ ./src/home/HomePage.vue 3:0-108 3:0-108 4:0-121 17:2-16
 @ ./src/_helpers/router.js
 @ ./src/_helpers/index.js
 @ ./src/index.js

ERROR in ./src/login/LoginPage.vue (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/login/LoginPage.vue)
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (36:8)

  34 |     },
  35 |     computed: {
> 36 |         ...mapState('account', ['status'])
     |         ^
  37 |     },
  38 |     created () {
  39 |         // reset login status

 @ ./src/login/LoginPage.vue 3:0-109 3:0-109 4:0-122 17:2-16
 @ ./src/_helpers/router.js
 @ ./src/_helpers/index.js
 @ ./src/index.js

ERROR in ./src/_store/users.module.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (43:20)

  41 |         state.all.items = state.all.items.map(user =>
  42 |             user.id === id
> 43 |                 ? { ...user, deleting: true }
     |                     ^
  44 |                 : user
  45 |         )
  46 |     },

 @ ./src/_store/index.js 6:0-39 14:8-13
 @ ./src/index.js

ERROR in ./src/register/RegisterPage.vue (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/register/RegisterPage.vue)
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (50:8)

  48 |     },
  49 |     computed: {
> 50 |         ...mapState('account', ['status'])
     |         ^
  51 |     },
  52 |     methods: {
  53 |         ...mapActions('account', ['register']),

 @ ./src/register/RegisterPage.vue 3:0-112 3:0-112 4:0-125 17:2-16
 @ ./src/_helpers/router.js
 @ ./src/_helpers/index.js
 @ ./src/index.js

ERROR in ./src/_services/user.service.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (71:19)

  69 |     const requestOptions = {
  70 |         method: 'PUT',
> 71 |         headers: { ...authHeader(), 'Content-Type': 'application/json' },
     |                    ^
  72 |         body: JSON.stringify(user)
  73 |     };
  74 | 

 @ ./src/_services/index.js 1:0-31 1:0-31
 @ ./src/_store/account.module.js
 @ ./src/_store/index.js
 @ ./src/index.js
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html] 963 bytes {0} [built]
    [./node_modules/lodash/lodash.js] 528 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built]
ℹ 「wdm」: Failed to compile.

Could advise on this error?

Thanks.

expose the token in the application cache

One import something is that, storing the user info in the localStorage will leak the user into out, you can get user info easily by web browser debug tool.

Any suggestion for this problem?

IsAuth() method

Hello!
I am trying to figure out the code.
Please tell me how can I create or call a method (if any) that determines whether the user is logged in or not?
For example IsAuth() method.
I need this for one public page, display a block that is visible only to those who are logged in.

I partially understand that this is due to VUEX, but I am still new to him.

About logout logic

  • I think maybe the logout action shoudn't be auto triggered in LoginPage,instead when the user found already logged in,the LoginPage should redirect to the HomePage and show a message saying "you are already logged in the site"?
  • btw,thanks for this great tutorial project,It's contains much more info and detail than a single blog🎉

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.