diff --git a/package.json b/package.json index 66fe43e..0ef61ce 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "vuex": "^3.0.1", "vuex-class": "^0.3.1", "vuex-module-decorators": "^0.4.3", + "vuex-router-sync": "^5.0.0", "vuex-typex": "^3.0.1" }, "devDependencies": { diff --git a/quasar.conf.js b/quasar.conf.js index 0b51dd9..7bb2755 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -9,7 +9,27 @@ const envparser = require('./config/envparser') const extendTypescriptToWebpack = (config) => { config.resolve .extensions - .add('.ts'); + .add('.ts', '.js', '.vue') + config.resolve + .alias + .set('@components', path.resolve(__dirname, 'src/components/index.ts')) + .set('@components', path.resolve(__dirname, 'src/components')) + .set('@views', path.resolve(__dirname, 'src/components/views/index.ts')) + .set('@views', path.resolve(__dirname, 'src/components/views')) + .set('@src', path.resolve(__dirname, 'src')) + .set('@icons', path.resolve(__dirname, 'src/assets/icons')) + .set('@images', path.resolve(__dirname, 'src/assets/images')) + .set('@classes', path.resolve(__dirname, 'src/classes/index.ts')) + .set('@utils', path.resolve(__dirname, 'src/utils/index.ts')) + .set('@utils', path.resolve(__dirname, 'src/utils/*')) + .set('@css', path.resolve(__dirname, 'src/styles/variables.scss')) + .set('@router', path.resolve(__dirname, 'src/router/index.ts')) + .set('@validators', path.resolve(__dirname, 'src/utils/validators.ts')) + .set('@api', path.resolve(__dirname, 'src/store/Api/index.ts')) + .set('@paths', path.resolve(__dirname, 'src/store/Api/ApiRoutes.ts')) + .set('@types', path.resolve(__dirname, 'src/typings/index.ts')) + .set('@store', path.resolve(__dirname, 'src/store/index.ts')) + .set('@modules', path.resolve(__dirname, 'src/store/Modules/index.ts')) config.module .rule('typescript') .test(/\.tsx?$/) @@ -68,7 +88,6 @@ module.exports = function (ctx) { .alias .set('~', __dirname) .set('@', path.resolve(__dirname, 'src')) - .set('@classes', path.resolve(__dirname, 'src/classes/index.ts')); config.module .rule('template-engine') .test(/\.pug$/) diff --git a/src/App.vue b/src/App.vue index 6d46246..ea564a2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,26 +15,38 @@ - diff --git a/src/classes/AlertsController.ts b/src/classes/AlertsController.ts index eb666f9..3d37c0e 100644 --- a/src/classes/AlertsController.ts +++ b/src/classes/AlertsController.ts @@ -1,46 +1,45 @@ -import { AlertsStore, LoginStore } from '@store'; -import {Forms} from './FormController'; +import {Forms} from './FormController' -import Router from '@router'; +import Router from '@router' export namespace AlertsElement { - type AlertType = "success" | "confirm" | "warning" | "error" | "info" | "form"; - type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; - type Omit = Pick>; + type AlertType = 'success' | 'confirm' | 'warning' | 'error' | 'info' | 'form' + type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T] + type Omit = Pick> type formParam = { form: Forms.Form, validations?: { - [x:string]: any + [x: string]: any }, submit: { - params?: {[x:string]: any}, + params?: {[x: string]: any}, trigger: Function } } - export class Alert{ - public type: AlertType; - public title: string; - public message?: string; - public strict?: boolean; - public actions: ActionsElements.Action[]; - public formElement?: formParam; + export class Alert { + public type: AlertType + public title: string + public message?: string + public strict?: boolean + public actions: ActionsElements.Action[] + public formElement?: formParam public onClose?: Function[] - constructor(fields?:{type: AlertType, title: string, message?: string, strict?: boolean, actions: ActionsElements.Action[], formElement?: formParam, onClose?: Function[]}) { - Object.assign(this, fields); - AlertsStore.actions.addAlert(this); + constructor(fields?: {type: AlertType, title: string, message?: string, strict?: boolean, actions: ActionsElements.Action[], formElement?: formParam, onClose?: Function[]}) { + Object.assign(this, fields) + AlertsStore.actions.addAlert(this) } async waitResponse() { - return AlertsStore.actions.addAlert(this); + return AlertsStore.actions.addAlert(this) } } export class WarningAlert extends Alert { constructor(fields?: {title: string, message?: string, strict?: boolean, actions?: ActionsElements.Action[], onClose?: Function[]}) { - const actions = fields.actions || []; + const actions = fields.actions || [] const confirmAction = (fields.actions && fields.actions.find(m => m.type == 'confirm')) ? undefined : new ActionsElements.ConfirmAction({}) console.log(fields.actions) super({ @@ -53,13 +52,13 @@ export namespace AlertsElement { ...actions, confirmAction ] - }); + }) } } export class SuccessAlert extends Alert { constructor(fields?: {title: string, message?: string, strict?: boolean, actions?: ActionsElements.Action[], onClose?: Function[]}) { - const actions = fields.actions || []; + const actions = fields.actions || [] const confirmAction = (fields.actions && fields.actions.find(m => m.type == 'confirm')) ? undefined : new ActionsElements.ConfirmAction({}) console.log(fields.actions) super({ @@ -72,13 +71,13 @@ export namespace AlertsElement { ...actions, confirmAction ] - }); + }) } } export class ErrorAlert extends Alert { constructor(fields?: {title: string, message?: string, strict?: boolean, actions?: ActionsElements.Action[], onClose?: Function[]}) { - const actions = fields.actions || []; + const actions = fields.actions || [] console.log(fields.actions) const confirmAction = (fields.actions && fields.actions.find(m => m.type == 'confirm')) ? undefined : new ActionsElements.ConfirmAction({text: 'Fermer'}) super({ @@ -91,12 +90,12 @@ export namespace AlertsElement { ...actions, confirmAction ] - }); + }) } } export class FormAlert extends Alert { - constructor(fields?: {title: string, message?: string, strict?:boolean, formElement: formParam, onClose?: Function[]}) { + constructor(fields?: {title: string, message?: string, strict?: boolean, formElement: formParam, onClose?: Function[]}) { const confirmAction = new ActionsElements.ConfirmAction({ text: 'Valider', triggers: [ @@ -115,7 +114,7 @@ export namespace AlertsElement { confirmAction, new ActionsElements.CancelAction() ] - }); + }) } } } @@ -127,37 +126,37 @@ export namespace AlertsElement { export namespace ActionsElements { - type ActionType = "confirm" | "action" | "cancel" | "link"; + type ActionType = 'confirm' | 'action' | 'cancel' | 'link' export class Action { - public type: ActionType; - public text: string; - public to?: {path: string} | {name: string, params?: {[x: string]: any}}; - public trigger?: Function; - public triggers?: Function[]; + public type: ActionType + public text: string + public to?: {path: string} | {name: string, params?: {[x: string]: any}} + public trigger?: Function + public triggers?: Function[] constructor({type, text, trigger, triggers, to}: Action) { - this.text = text; - this.type = type; - this.trigger = trigger; - this.triggers = triggers; - this.to = to; + this.text = text + this.type = type + this.trigger = trigger + this.triggers = triggers + this.to = to } } export class ConfirmAction extends Action { constructor({text, triggers}: {text?: string, triggers?: Function[]}) { super({ - text: text || "Ça marche!", - type: "confirm", - }); + text: text || 'Ça marche!', + type: 'confirm' + }) if (triggers) { this.triggers = [ ...triggers, - AlertsStore.mutations.confirmAlert, - ]; + AlertsStore.mutations.confirmAlert + ] } else { - this.trigger = this.trigger = AlertsStore.mutations.confirmAlert; + this.trigger = this.trigger = AlertsStore.mutations.confirmAlert } } } @@ -167,30 +166,30 @@ export namespace ActionsElements { super({ text: text, to: to, - type: "link", - }); + type: 'link' + }) } } export class LoginAction extends Action { constructor() { super({ - text: "Se connecter", - type: "action", + text: 'Se connecter', + type: 'action', triggers: [ LoginStore.mutations.showLogin, AlertsStore.actions.hideAlert ] - }); + }) } } export class CancelAction extends Action { constructor() { super({ - text: "Annuler", - type: "cancel", + text: 'Annuler', + type: 'cancel', trigger: AlertsStore.mutations.cancelAlert - }); + }) } } diff --git a/src/layouts/drawer/drawer.vue b/src/layouts/drawer/drawer.vue index 63aa569..8dc56eb 100644 --- a/src/layouts/drawer/drawer.vue +++ b/src/layouts/drawer/drawer.vue @@ -32,8 +32,8 @@ import menuTwo from './menuTwo.vue' import { Component, Vue, Watch, Prop } from 'vue-property-decorator' - import { GlobModule } from '../../store/Modules/glob' - import { UserModule } from '../../store/Modules/user'; + import { GlobalStore } from '@store' + import { UserStore } from '@store'; @Component({ components: { @@ -74,14 +74,14 @@ } get MenuCollapse () { - return GlobModule.menuCollapse + return GlobalStore.getters.menuCollapse } get Username () { - return UserModule.username + return UserStore.getters.username } get Verificato () { - return UserModule.verifiedEmail + return UserStore.getters.verifiedEmail } logoutHandler() { diff --git a/src/model/glob.ts b/src/model/GlobalStore.ts similarity index 100% rename from src/model/glob.ts rename to src/model/GlobalStore.ts diff --git a/src/model/user.ts b/src/model/UserStore.ts similarity index 100% rename from src/model/user.ts rename to src/model/UserStore.ts diff --git a/src/model/index.ts b/src/model/index.ts index 4be06db..3d85135 100644 --- a/src/model/index.ts +++ b/src/model/index.ts @@ -1,5 +1,5 @@ -export * from './user' -export * from './glob' +export * from './UserStore' +export * from './GlobalStore' export * from './signup-option' export * from './key-value' export * from './payload' diff --git a/src/root/home/home.ts b/src/root/home/home.ts index 15a8046..d25b851 100644 --- a/src/root/home/home.ts +++ b/src/root/home/home.ts @@ -1,6 +1,6 @@ import Vue from 'vue' -import { Component, Watch, Prop } from 'vue-property-decorator' -import { GlobModule } from '@/store/Modules/glob' +import { Component } from 'vue-property-decorator' +import { GlobalStore } from '@store' require('./home.scss') @@ -29,12 +29,12 @@ export default class Home extends Vue { } get conta() { - return GlobModule.conta + return GlobalStore.getters.getConta } set conta(valore) { - GlobModule.setConta(valore) - var my = this.$q.i18n.lang + GlobalStore.actions.setConta(valore) + let my = this.$q.i18n.lang this.showNotification(String(my)) } diff --git a/src/store/EventBus.ts b/src/store/EventBus.ts new file mode 100644 index 0000000..1e0da43 --- /dev/null +++ b/src/store/EventBus.ts @@ -0,0 +1,4 @@ +import Vue from 'vue' +const EventBus = new Vue() + +export default EventBus diff --git a/src/store/Modules/glob.ts b/src/store/Modules/GlobalStore.ts similarity index 89% rename from src/store/Modules/glob.ts rename to src/store/Modules/GlobalStore.ts index ff19aa7..eaf674e 100644 --- a/src/store/Modules/glob.ts +++ b/src/store/Modules/GlobalStore.ts @@ -1,15 +1,6 @@ -import Vue from 'vue' -import Vuex from 'vuex' - -import { Module, VuexModule, Mutation, MutationAction, Action, getModule } from 'vuex-module-decorators' - import { IGlobalState } from '@types' - import { storeBuilder } from '@store' -Vue.use(Vuex) - - const state: IGlobalState = { conta: 0, isLoginPage: false, @@ -73,7 +64,7 @@ namespace Mutations { } namespace Actions { - async function setConta(num: number) { + async function setConta(context, num: number) { Mutations.mutations.setConta(num) } diff --git a/src/store/Modules/user.ts b/src/store/Modules/UserStore.ts similarity index 84% rename from src/store/Modules/user.ts rename to src/store/Modules/UserStore.ts index 62c1b23..6d808c7 100644 --- a/src/store/Modules/user.ts +++ b/src/store/Modules/UserStore.ts @@ -1,36 +1,20 @@ -import Vue from 'vue' -import Vuex from 'vuex' - -import { Module, VuexModule, Mutation, MutationAction, Action, getModule } from 'vuex-module-decorators' -import {Route} from 'vue-router' import Api from '@api' +import { ISignupOptions, IUserState } from 'model' +import { ILinkReg, IResult, IIdToken } from 'model/other' +import { storeBuilder } from '@store' +import router from '@router' + +import { serv_constants } from '../Modules/serv_constants' +import { rescodes } from '../Modules/rescodes' + + const bcrypt = require('bcryptjs') -import * as types from 'store/mutation-types' -import { serv_constants } from 'store/Modules/serv_constants' -import router from '@router' - -import { storeBuilder } from '@store' - - -import { ISignupOptions, IUserState } from 'model' -import { ILinkReg, IResult, IIdToken } from 'model/other' - - -export const ErroriMongoDb = { - CALLING: 10, - OK: 20, - ERR_GENERICO: -1, - DUPLICATE_EMAIL_ID: 11000, - DUPLICATE_USERNAME_ID: 11100 -} - -Vue.use(Vuex) - -const initialState: IUserState = { +// State +const state: IUserState = { _id: '', email: '', username: '', @@ -44,8 +28,6 @@ const initialState: IUserState = { verifiedEmail: false } -// State -const state = {...initialState} const b = storeBuilder.module('UserModule', state) const stateGetter = b.state() @@ -177,7 +159,7 @@ namespace Actions { } - async function resetpwd (paramquery: IUserState) { + async function resetpwd (context, paramquery: IUserState) { let call = process.env.MONGODB_HOST + '/updatepwd' console.log('CALL ' + call) @@ -190,7 +172,7 @@ namespace Actions { } console.log(usertosend) - Mutations.mutations.setServerCode(ErroriMongoDb.CALLING) + Mutations.mutations.setServerCode(rescodes.CALLING) let myres @@ -204,8 +186,8 @@ namespace Actions { if (myres.status === 200) { return myres.json() } - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore: ' + myres.status, resetpwd: true } + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return { code: rescodes.ERR_GENERICO, msg: 'Errore: ' + myres.status, resetpwd: true } }) .then((body) => { @@ -215,13 +197,13 @@ namespace Actions { return { code: body.code, msg: body.msg } }).catch((err) => { console.log('ERROR: ' + err) - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore' } + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return { code: rescodes.ERR_GENERICO, msg: 'Errore' } }) } - async function requestpwd (paramquery: IUserState) { + async function requestpwd (context, paramquery: IUserState) { let call = process.env.MONGODB_HOST + '/requestnewpwd' console.log('CALL ' + call) @@ -233,7 +215,7 @@ namespace Actions { } console.log(usertosend) - Mutations.mutations.setServerCode(ErroriMongoDb.CALLING) + Mutations.mutations.setServerCode(rescodes.CALLING) let myres @@ -244,21 +226,21 @@ namespace Actions { if (myres.status === 200) { return myres.json() } - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore: ' + myres.status, resetpwd: true } + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return { code: rescodes.ERR_GENERICO, msg: 'Errore: ' + myres.status, resetpwd: true } }) .then((body) => { return { code: body.code, msg: body.msg } }).catch((err) => { console.log('ERROR: ' + err) - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore' } + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return { code: rescodes.ERR_GENERICO, msg: 'Errore' } }) } - async function vreg (paramquery: ILinkReg) { + async function vreg (context, paramquery: ILinkReg) { let call = process.env.MONGODB_HOST + '/vreg' console.log('CALL ' + call) @@ -269,7 +251,7 @@ namespace Actions { } console.log(usertosend) - Mutations.mutations.setServerCode(ErroriMongoDb.CALLING) + Mutations.mutations.setServerCode(rescodes.CALLING) let myres @@ -280,8 +262,8 @@ namespace Actions { if (myres.status === 200) { return myres.json() } - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore: ' + myres.status } + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return { code: rescodes.ERR_GENERICO, msg: 'Errore: ' + myres.status } }) .then((body) => { @@ -293,12 +275,12 @@ namespace Actions { return { code: body.code, msg: body.msg } }).catch((err) => { console.log('ERROR: ' + err) - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore' } + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return { code: rescodes.ERR_GENERICO, msg: 'Errore' } }) } - async function signup (authData: ISignupOptions) { + async function signup (context, authData: ISignupOptions) { let call = process.env.MONGODB_HOST + '/users' console.log('CALL ' + call) @@ -322,7 +304,7 @@ namespace Actions { let myres: IResult - Mutations.mutations.setServerCode(ErroriMongoDb.CALLING) + Mutations.mutations.setServerCode(rescodes.CALLING) let x_auth_token: string = '' @@ -333,7 +315,7 @@ namespace Actions { if (x_auth_token) { return res.json() } else { - return { status: 400, code: ErroriMongoDb.ERR_GENERICO } + return { status: 400, code: rescodes.ERR_GENERICO } } }) .then((body) => { @@ -372,7 +354,7 @@ namespace Actions { // dispatch('storeUser', authData); // dispatch('setLogoutTimer', myres.data.expiresIn); - return ErroriMongoDb.OK + return rescodes.OK } else if (myres.status === 404) { if (process.env.DEV) { console.log('CODE = ' + body.code) @@ -390,13 +372,13 @@ namespace Actions { console.log('ERROREEEEEEEEE') console.log(error) } - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return ErroriMongoDb.ERR_GENERICO + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return rescodes.ERR_GENERICO }) }) } - async function signin (authData: ISignupOptions) { + async function signin (context, authData: ISignupOptions) { let call = process.env.MONGODB_HOST + '/users/login' console.log('LOGIN ' + call) @@ -414,7 +396,7 @@ namespace Actions { let myres: IResult - Mutations.mutations.setServerCode(ErroriMongoDb.CALLING) + Mutations.mutations.setServerCode(rescodes.CALLING) let x_auth_token: string = '' @@ -427,7 +409,7 @@ namespace Actions { if (x_auth_token || injson) { return injson } else { - return { status: 400, code: ErroriMongoDb.ERR_GENERICO } + return { status: 400, code: rescodes.ERR_GENERICO } } }) .then((body) => { @@ -472,7 +454,7 @@ namespace Actions { // dispatch('storeUser', authData); // dispatch('setLogoutTimer', myres.data.expiresIn); - return ErroriMongoDb.OK + return rescodes.OK } else if (myres.status === 404) { if (process.env.DEV) { console.log('CODE = ' + body.code) @@ -490,12 +472,12 @@ namespace Actions { console.log('ERROREEEEEEEEE') console.log(error) } - Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO) - return ErroriMongoDb.ERR_GENERICO + Mutations.mutations.setServerCode(rescodes.ERR_GENERICO) + return rescodes.ERR_GENERICO }) } - async function logout () { + async function logout (context) { let call = process.env.MONGODB_HOST + '/users/me/token' console.log('CALL ' + call) diff --git a/src/store/Modules/index.ts b/src/store/Modules/index.ts index f4828e0..38b5fa1 100644 --- a/src/store/Modules/index.ts +++ b/src/store/Modules/index.ts @@ -1,2 +1,3 @@ export {storeBuilder} from './Store/Store' -export {default as User} from './user' +export {default as GlobalStore} from './GlobalStore' +export {default as UserStore} from './UserStore' diff --git a/src/store/Modules/rescodes.ts b/src/store/Modules/rescodes.ts new file mode 100644 index 0000000..930ca9b --- /dev/null +++ b/src/store/Modules/rescodes.ts @@ -0,0 +1,7 @@ +export const rescodes = { + CALLING: 10, + OK: 20, + ERR_GENERICO: -1, + DUPLICATE_EMAIL_ID: 11000, + DUPLICATE_USERNAME_ID: 11100 +} diff --git a/src/store/Modules/serv_constants.ts b/src/store/Modules/serv_constants.ts index 3b315c8..d3fd1b6 100644 --- a/src/store/Modules/serv_constants.ts +++ b/src/store/Modules/serv_constants.ts @@ -7,4 +7,6 @@ export const serv_constants = { RIS_CODE_LOGIN_ERR_GENERIC: -20, RIS_CODE_LOGIN_ERR: -10, RIS_CODE_LOGIN_OK: 1 + + } diff --git a/src/store/index.ts b/src/store/index.ts index 3155e59..2bf5b9a 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,22 +1,23 @@ import Vue from 'vue' import Vuex from 'vuex' + import { IUserState, IGlobState } from 'model' import {Route} from 'vue-router' - Vue.use(Vuex) + export interface RootState { - user: IUserState - glob: IGlobState + GlobalModule: IGlobState route: Route } -// const store = new Vuex.Store({}) - -// export default store +export const DebugMode = true export * from './Modules' -// export {default as EventBus} from './EventBus'; +export {default as EventBus} from './EventBus' export {default as Api} from './Api' + +export default new Vuex.Store({ +}) diff --git a/src/views/login/requestresetpwd.vue b/src/views/login/requestresetpwd.vue index 5a54035..0aa0dfe 100644 --- a/src/views/login/requestresetpwd.vue +++ b/src/views/login/requestresetpwd.vue @@ -50,7 +50,7 @@ import {mapActions} from 'vuex' import * as types from '../../store/mutation-types' - //import {ErroriMongoDb} from '../../store/Modules/user' + import { rescodes } from '../../../store/Modules/rescodes' import {serv_constants} from '../../store/Modules/serv_constants'; diff --git a/src/views/login/signin.vue b/src/views/login/signin.vue index 09b5cc6..9e4817a 100644 --- a/src/views/login/signin.vue +++ b/src/views/login/signin.vue @@ -64,7 +64,7 @@ import {mapGetters, mapActions} from 'vuex' import * as types from '../../store/mutation-types' - //import {ErroriMongoDb} from '../../store/Modules/user' + import { rescodes } from '../../../store/Modules/rescodes' import {serv_constants} from "../../store/Modules/serv_constants"; import axios from 'axios'; @@ -128,7 +128,7 @@ }, checkErrors(riscode) { //console.log("RIS = " + riscode); - if (riscode === ErroriMongoDb.OK) { + if (riscode === rescodes.OK) { this.showNotif({type: 'positive', message: this.$t('login.completato')}); this.$router.push('/'); } else if (riscode === serv_constants.RIS_CODE_LOGIN_ERR) { diff --git a/src/views/login/signup/signup.ts b/src/views/login/signup/signup.ts index c5cc5fb..f7f2c39 100644 --- a/src/views/login/signup/signup.ts +++ b/src/views/login/signup/signup.ts @@ -1,7 +1,7 @@ import Vue from 'vue' import { Component, Prop, Watch } from 'vue-property-decorator' -import { User } from '@store' -import { ErroriMongoDb } from 'store/Modules/user' +import { UserStore } from '@store' +import { rescodes } from '../../../store/Modules/rescodes' import { required, email, numeric, maxLength, maxValue, minValue, sameAs, minLength } from 'vuelidate/lib/validators' import { ISignupOptions, IUserState } from 'model' @@ -131,11 +131,11 @@ export default class Signup extends Vue { checkErrors(riscode: number) { // console.log("RIS = " + riscode); - if (riscode === ErroriMongoDb.DUPLICATE_EMAIL_ID) { + if (riscode === rescodes.DUPLICATE_EMAIL_ID) { this.showNotif(this.$t('reg.err.duplicate_email')) - } else if (riscode === ErroriMongoDb.DUPLICATE_USERNAME_ID) { + } else if (riscode === rescodes.DUPLICATE_USERNAME_ID) { this.showNotif(this.$t('reg.err.duplicate_username')) - } else if (riscode === ErroriMongoDb.OK) { + } else if (riscode === rescodes.OK) { this.$router.push('/') } else { this.showNotif('Errore num ' + riscode) @@ -162,7 +162,7 @@ export default class Signup extends Vue { this.$q.loading.show({ message: this.$t('reg.incorso') }) console.log(this.signup) - User.actions.signup(this.signup) + UserStore.actions.signup(this.signup) .then((riscode) => { this.checkErrors(riscode) this.$q.loading.hide() diff --git a/src/views/login/test.vue b/src/views/login/test.vue index 5c94c7b..56375bf 100644 --- a/src/views/login/test.vue +++ b/src/views/login/test.vue @@ -24,7 +24,7 @@