Altra conversione in Typescript , partendo da un progetto di esempio funzionante... 2
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"dotenv": "^6.1.0",
|
"dotenv": "^6.1.0",
|
||||||
|
"vee-validate": "^2.1.2",
|
||||||
"vue-i18n": "^8.1.0",
|
"vue-i18n": "^8.1.0",
|
||||||
"vue-property-decorator": "^7.2.0",
|
"vue-property-decorator": "^7.2.0",
|
||||||
"vuelidate": "^0.7.4",
|
"vuelidate": "^0.7.4",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ module.exports = function (ctx) {
|
|||||||
store: 'src/store/index.ts'
|
store: 'src/store/index.ts'
|
||||||
},
|
},
|
||||||
// app plugins (/src/plugins)
|
// app plugins (/src/plugins)
|
||||||
plugins: ['i18n', 'axios', 'vuelidate'],
|
plugins: ['i18n', 'axios', 'vee-validate'],
|
||||||
css: [
|
css: [
|
||||||
'app.styl'
|
'app.styl'
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
import drawer from '../layouts/drawer/drawer.vue'
|
import drawer from '../layouts/drawer/drawer.vue'
|
||||||
import messagePopover from '../layouts/toolbar/messagePopover.vue'
|
import messagePopover from '../layouts/toolbar/messagePopover.vue'
|
||||||
|
|
||||||
import user from '../store/modules/user';
|
// import user from '../store/modules/user';
|
||||||
|
|
||||||
import * as types from '../store/mutation-types'
|
import * as types from '../store/mutation-types'
|
||||||
|
|
||||||
|
|||||||
5
src/plugins/vee-validate.js
Normal file
5
src/plugins/vee-validate.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import VeeValidate from "vee-validate";
|
||||||
|
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
Vue.use(VeeValidate, { inject: false })
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@ import { RouteConfig } from 'vue-router'
|
|||||||
|
|
||||||
const routes: RouteConfig[] = [
|
const routes: RouteConfig[] = [
|
||||||
{ path: '/', component: () => import('@/pages/Index.vue'), meta: { name: 'Home' } },
|
{ path: '/', component: () => import('@/pages/Index.vue'), meta: { name: 'Home' } },
|
||||||
/* { path: '/signup', component: () => import('@/views/login/signup.vue'), meta: { name: 'Registration' } },
|
{ path: '/test', component: () => import('@/views/login/test.vue'), meta: { name: 'Test' } },
|
||||||
|
/*
|
||||||
|
{ path: '/signup', component: () => import('@/views/login/signup.vue'), meta: { name: 'Registration' } },
|
||||||
{ path: '/signin', component: () => import('@/views/login/signin.vue'), meta: { name: 'Login' } },
|
{ path: '/signin', component: () => import('@/views/login/signin.vue'), meta: { name: 'Login' } },
|
||||||
{ path: '/vreg', component: () => import('@/views/login/vreg.vue'), meta: { name: 'Verify Reg' } },
|
{ path: '/vreg', component: () => import('@/views/login/vreg.vue'), meta: { name: 'Verify Reg' } },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Vuex from 'vuex'
|
|||||||
|
|
||||||
import { Module, VuexModule, Mutation, MutationAction, Action, getModule } from 'vuex-module-decorators'
|
import { Module, VuexModule, Mutation, MutationAction, Action, getModule } from 'vuex-module-decorators'
|
||||||
|
|
||||||
let bcrypt = require('bcryptjs')
|
const bcrypt = require('bcryptjs')
|
||||||
|
|
||||||
import * as types from '@/store/mutation-types'
|
import * as types from '@/store/mutation-types'
|
||||||
import { serv_constants } from '@/store/modules/serv_constants'
|
import { serv_constants } from '@/store/modules/serv_constants'
|
||||||
@@ -22,8 +22,8 @@ export const ErroriMongoDb = {
|
|||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
@Module
|
@Module({ dynamic: true, store, name: 'user' })
|
||||||
export default class User extends VuexModule implements IUserState { // Non occorrono i getters, basta questi qui:
|
class User extends VuexModule {
|
||||||
_id: IUserState['_id'] = ''
|
_id: IUserState['_id'] = ''
|
||||||
email: IUserState['email'] = ''
|
email: IUserState['email'] = ''
|
||||||
username: IUserState['username'] = ''
|
username: IUserState['username'] = ''
|
||||||
@@ -47,7 +47,7 @@ export default class User extends VuexModule implements IUserState { // Non oc
|
|||||||
|
|
||||||
sendRequest(url: string, method: string, mydata: any) {
|
sendRequest(url: string, method: string, mydata: any) {
|
||||||
console.log('LANG ' + this.getlang())
|
console.log('LANG ' + this.getlang())
|
||||||
let mytok: string = this.getTok()
|
const mytok: string = this.getTok()
|
||||||
|
|
||||||
const authHeader = new Headers()
|
const authHeader = new Headers()
|
||||||
authHeader.append('content-type', 'application/json')
|
authHeader.append('content-type', 'application/json')
|
||||||
@@ -503,3 +503,5 @@ export default class User extends VuexModule implements IUserState { // Non oc
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const UserModule = getModule(User.prototype)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
import {mapActions} from 'vuex'
|
import {mapActions} from 'vuex'
|
||||||
import * as types from '../../store/mutation-types'
|
import * as types from '../../store/mutation-types'
|
||||||
import {ErroriMongoDb} from '../../store/modules/user'
|
//import {ErroriMongoDb} from '../../store/modules/user'
|
||||||
|
|
||||||
import {serv_constants} from '../../store/modules/serv_constants';
|
import {serv_constants} from '../../store/modules/serv_constants';
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
import {mapGetters, mapActions} from 'vuex'
|
import {mapGetters, mapActions} from 'vuex'
|
||||||
import * as types from '../../store/mutation-types'
|
import * as types from '../../store/mutation-types'
|
||||||
|
|
||||||
import {ErroriMongoDb} from '../../store/modules/user'
|
//import {ErroriMongoDb} from '../../store/modules/user'
|
||||||
import {serv_constants} from "../../store/modules/serv_constants";
|
import {serv_constants} from "../../store/modules/serv_constants";
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {
|
import {
|
||||||
required,
|
required,
|
||||||
email,
|
email,
|
||||||
@@ -107,7 +108,7 @@
|
|||||||
import {mapGetters, mapActions} from 'vuex'
|
import {mapGetters, mapActions} from 'vuex'
|
||||||
import * as types from '../../store/mutation-types'
|
import * as types from '../../store/mutation-types'
|
||||||
|
|
||||||
import {ErroriMongoDb} from '../../store/modules/user'
|
//import {ErroriMongoDb} from '../../store/modules/user'
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
|
import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
|
||||||
|
|||||||
47
src/views/login/test.vue
Normal file
47
src/views/login/test.vue
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<q-page padding class="signup">
|
||||||
|
<div class="text-center">
|
||||||
|
<p>
|
||||||
|
<!--<img src="../../../assets/quasar-logo-full.svg">-->
|
||||||
|
<img :src="`../../../assets/`+`${env('LOGO_REG')}`">
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
|
||||||
|
|
||||||
|
<q-field
|
||||||
|
:error="$v.form.email.$error"
|
||||||
|
:error-label="`${errorMsg('email', $v.form.email)}`"
|
||||||
|
>
|
||||||
|
<q-input
|
||||||
|
v-validate="'required|email'"
|
||||||
|
v-model="form.email"
|
||||||
|
:value="form.email"
|
||||||
|
@change="val => { form.email = val }"
|
||||||
|
:before="[{icon: 'mail', handler () {}}]"
|
||||||
|
@blur="$v.form.email.$touch"
|
||||||
|
:error="$v.form.email.$error"
|
||||||
|
:float-label="$t('reg.email')"
|
||||||
|
/>
|
||||||
|
</q-field>
|
||||||
|
</q-page>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Vue, Watch } from 'vue-property-decorator';
|
||||||
|
import { UserModule } from '@/store/modules/user';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Component({})
|
||||||
|
export default class Login extends Vue {
|
||||||
|
form = {
|
||||||
|
email: 'prova@prova.com',
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
import {mapActions} from 'vuex'
|
import {mapActions} from 'vuex'
|
||||||
import * as types from '../../store/mutation-types'
|
import * as types from '../../store/mutation-types'
|
||||||
import {ErroriMongoDb} from '../../store/modules/user'
|
//import {ErroriMongoDb} from '../../store/modules/user'
|
||||||
|
|
||||||
import {serv_constants} from '../../store/modules/serv_constants';
|
import {serv_constants} from '../../store/modules/serv_constants';
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
import {mapActions} from 'vuex'
|
import {mapActions} from 'vuex'
|
||||||
import * as types from '../../store/mutation-types'
|
import * as types from '../../store/mutation-types'
|
||||||
import {ErroriMongoDb} from '../../store/modules/user'
|
//import {ErroriMongoDb} from '../../store/modules/user'
|
||||||
|
|
||||||
import {serv_constants} from '../../store/modules/serv_constants';
|
import {serv_constants} from '../../store/modules/serv_constants';
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +1,41 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "esnext",
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"esModuleInterop": true,
|
"jsx": "preserve",
|
||||||
"sourceMap": true,
|
"importHelpers": true,
|
||||||
"experimentalDecorators": true,
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"lib": [
|
"experimentalDecorators": true,
|
||||||
"es2015",
|
"esModuleInterop": true,
|
||||||
"dom"
|
"allowSyntheticDefaultImports": true,
|
||||||
],
|
"sourceMap": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": "./",
|
||||||
"paths": {
|
|
||||||
"~/*": ["./*"],
|
|
||||||
"@/*": ["src/*"]
|
|
||||||
},
|
|
||||||
"types": [
|
"types": [
|
||||||
"node",
|
"node",
|
||||||
"jest"
|
"jest"
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"@/*": [
|
||||||
|
"src/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"lib": [
|
||||||
|
"esnext",
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"scripthost"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"test/**/*.ts"
|
"tests/**/*.ts",
|
||||||
|
"tests/**/*.tsx",
|
||||||
|
"config/**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
".quasar",
|
|
||||||
"dist",
|
|
||||||
"node_modules"
|
"node_modules"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
24
tslint.json
24
tslint.json
@@ -1,13 +1,25 @@
|
|||||||
{
|
{
|
||||||
"defaultSeverity": "warning",
|
"defaultSeverity": "warning",
|
||||||
"extends": [
|
"extends": [
|
||||||
"tslint-config-standard"
|
"tslint:recommended"
|
||||||
],
|
],
|
||||||
|
"linterOptions": {
|
||||||
|
"exclude": [
|
||||||
|
"node_modules/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
/*"semicolon": [
|
"semicolon": [true, "never"],
|
||||||
true,
|
"trailing-comma": [true, {"multiline": "never", "singleline": "never"}],
|
||||||
"always",
|
"quotemark": [true, "single"],
|
||||||
"ignore-bound-class-methods"
|
"indent": [true, "spaces", 2],
|
||||||
]*/
|
"interface-name": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"max-line-length": false,
|
||||||
|
"member-access": false,
|
||||||
|
"no-console": [true, "warning"],
|
||||||
|
"no-consecutive-blank-lines": false,
|
||||||
|
"no-empty": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9021,6 +9021,11 @@ vary@~1.1.2:
|
|||||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||||
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
|
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
|
||||||
|
|
||||||
|
vee-validate@^2.1.2:
|
||||||
|
version "2.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/vee-validate/-/vee-validate-2.1.2.tgz#4dc99bbca1358d2cee2b8d0fe7ebd59ab968de08"
|
||||||
|
integrity sha512-6Gr7jxXRnRhAg4QKedWF2mqtJ5MF6os8OBUtWS4XTOyGMbwa1UsJOPogqxEJA1qNqf5fUwqr/uP5Vs1zVyHSxA==
|
||||||
|
|
||||||
vendors@^1.0.0:
|
vendors@^1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.2.tgz#7fcb5eef9f5623b156bcea89ec37d63676f21801"
|
resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.2.tgz#7fcb5eef9f5623b156bcea89ec37d63676f21801"
|
||||||
|
|||||||
Reference in New Issue
Block a user