Ancora sistemazioni con typescript....
This commit is contained in:
@@ -43,7 +43,8 @@
|
||||
"vuelidate": "^0.7.4",
|
||||
"vuex": "^3.0.1",
|
||||
"vuex-class": "^0.3.1",
|
||||
"vuex-module-decorators": "^0.4.3"
|
||||
"vuex-module-decorators": "^0.4.3",
|
||||
"vuex-typex": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.2",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<script type="ts">
|
||||
|
||||
import { Component, Vue} from 'vue-property-decorator'
|
||||
import { UserModule } from './store/modules/user'
|
||||
import { UserModule } from './store/Modules/user'
|
||||
|
||||
import Header from './components/Header.vue';
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
import drawer from '../layouts/drawer/drawer.vue'
|
||||
import messagePopover from '../layouts/toolbar/messagePopover.vue'
|
||||
|
||||
// import user from '../store/modules/user';
|
||||
// import user from '../store/Modules/user';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -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 { GlobModule } from '../../store/Modules/glob'
|
||||
import { UserModule } from '../../store/Modules/user';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AxiosError, AxiosResponse } from 'axios'
|
||||
import { PayloadMessageTypes } from '@/common'
|
||||
import { PayloadMessageTypes } from 'common'
|
||||
import { IPayload } from './payload'
|
||||
|
||||
export { PayloadMessageTypes } from '../../common/message'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IToken } from '@/model/other'
|
||||
import { IToken } from 'model/other'
|
||||
|
||||
export const DefaultUser = <IUserState>{
|
||||
email: '',
|
||||
@@ -25,4 +25,6 @@ export interface IUserState {
|
||||
verifiedEmail?: boolean
|
||||
|
||||
tokenforgot?: string
|
||||
|
||||
servercode?: number
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Watch, Prop } from 'vue-property-decorator'
|
||||
import { GlobModule } from '@/store/modules/glob'
|
||||
import { GlobModule } from '@/store/Modules/glob'
|
||||
|
||||
require('./home.scss')
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ Vue.use(VueRouter)
|
||||
* directly export the Router instantiation
|
||||
*/
|
||||
|
||||
export default function (/* { store, ssrContext } */) {
|
||||
const Router = new VueRouter({
|
||||
scrollBehavior: () => ({ y: 0 } as PositionResult),
|
||||
routes: RouteConfig,
|
||||
@@ -21,5 +20,4 @@ export default function (/* { store, ssrContext } */) {
|
||||
base: process.env.VUE_ROUTER_BASE
|
||||
})
|
||||
|
||||
return Router
|
||||
}
|
||||
export default Router
|
||||
|
||||
16
src/store/Api/ApiRoutes.ts
Normal file
16
src/store/Api/ApiRoutes.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
const ServerRoutes = {
|
||||
LOGIN: 'login_check',
|
||||
TOKEN_REFRESH: 'token/refresh',
|
||||
SIGNUP: 'register/',
|
||||
MOVING_LIST: 'announcements',
|
||||
MOVING_DETAIL: 'announcement/',
|
||||
MOVING_CREATE: 'announcement',
|
||||
MOVING_USER_INFOS: 'user/verify',
|
||||
PARTICIPATION_CREATE: 'participations',
|
||||
CREATE_NOTE: 'note_user',
|
||||
MOVERS_LIST: 'movers',
|
||||
NEW_MOVER: 'mover',
|
||||
USERS: 'users'
|
||||
}
|
||||
|
||||
export default ServerRoutes
|
||||
106
src/store/Api/ApiTypes.ts
Normal file
106
src/store/Api/ApiTypes.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
// import { NotificationsStore, LoginStore } from '@store'
|
||||
|
||||
export class AxiosSuccess {
|
||||
public success: boolean = true
|
||||
public status: number
|
||||
public data: any
|
||||
|
||||
constructor(data: any) {
|
||||
this.data = data
|
||||
}
|
||||
}
|
||||
|
||||
export class AxiosError {
|
||||
public success: boolean = false
|
||||
public status: number
|
||||
public data: any
|
||||
|
||||
constructor(status: number, data?: any) {
|
||||
this.status = status
|
||||
this.data = data
|
||||
if (status !== 401) {
|
||||
// if (status == 0) message = 'Vérifiez votre connexion Internet';
|
||||
// NotificationsStore.actions.addNotification({ type: 'warning', message: message })
|
||||
}
|
||||
else {
|
||||
if (data.error && data.error.message !== 'Bad credentials') {
|
||||
// LoginStore.actions.disconnectRequest()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// export class ApiResponse {
|
||||
// public success: boolean = true;
|
||||
// public message?: string;
|
||||
// public data?: any;
|
||||
// public type: string;
|
||||
// constructor(fields: {message?: string, data?: any, type: any, success: boolean}) {
|
||||
// this.message = fields.message;
|
||||
// this.type = fields.type;
|
||||
// this.data = fields.data ? fields.data : {};
|
||||
// this.success = fields.success;
|
||||
// }
|
||||
|
||||
// yes() {
|
||||
// return Promise.resolve(this);
|
||||
// }
|
||||
// }
|
||||
|
||||
export interface IApiResponse {
|
||||
success: boolean
|
||||
message?: string
|
||||
data?: any
|
||||
type: string
|
||||
}
|
||||
|
||||
export class ApiResponse {
|
||||
public data?: any
|
||||
public message?: any
|
||||
constructor(fields: {message?: string, data?: any, type: any, success: boolean}) {
|
||||
let returnData: any = {}
|
||||
returnData.message = fields.message
|
||||
returnData.type = fields.type
|
||||
returnData.data = fields.data != null ? fields.data : {}
|
||||
returnData.success = fields.success
|
||||
if (fields.success) return <any>Promise.resolve(returnData)
|
||||
else return <any>Promise.reject(returnData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export class ApiSuccess extends ApiResponse {
|
||||
constructor(fields: {message?: string, data?: any} = {}) {
|
||||
super({
|
||||
success: true,
|
||||
type: 'success',
|
||||
message: fields.message,
|
||||
data: fields.data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class ApiError extends ApiResponse {
|
||||
constructor(fields: {message?: string, data?: any} = {}) {
|
||||
super({
|
||||
success: false,
|
||||
type: 'error',
|
||||
message: fields.message,
|
||||
data: fields.data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class ApiWarning extends ApiResponse {
|
||||
constructor(fields: {message?: string, data?: any} = {}) {
|
||||
super({
|
||||
success: false,
|
||||
type: 'warning',
|
||||
message: fields.message,
|
||||
data: fields.data
|
||||
})
|
||||
}
|
||||
}
|
||||
23
src/store/Api/Inst-Pao.ts
Normal file
23
src/store/Api/Inst-Pao.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import axios, { AxiosInstance, AxiosPromise, AxiosResponse, AxiosInterceptorManager } from 'axios'
|
||||
|
||||
async function sendRequest (url: string, lang: string, mytok: string, method: string, mydata: any) {
|
||||
console.log('LANG ' + lang)
|
||||
// let mytok: string = this.getTok()
|
||||
const authHeader = new Headers()
|
||||
|
||||
authHeader.append('content-type', 'application/json')
|
||||
authHeader.append('x-auth', mytok)
|
||||
authHeader.append('accept-language', lang)
|
||||
const configInit: RequestInit = {
|
||||
method: method,
|
||||
cache: 'no-cache',
|
||||
body: JSON.stringify(mydata),
|
||||
headers: authHeader
|
||||
}
|
||||
|
||||
const request: Promise<Response> = fetch(url, configInit)
|
||||
return request
|
||||
|
||||
}
|
||||
|
||||
export default sendRequest
|
||||
73
src/store/Api/Instance.ts
Normal file
73
src/store/Api/Instance.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import axios, { AxiosInstance, AxiosPromise, AxiosResponse, AxiosInterceptorManager } from 'axios'
|
||||
// import LoginModule from '../Modules/Auth/LoginStore'
|
||||
import router from '@router'
|
||||
import {clone} from 'lodash'
|
||||
import * as Types from './ApiTypes'
|
||||
|
||||
export const API_URL = process.env.API_URL
|
||||
export const APP_BASE = process.env.NODE_ENV === 'development' ? 'http://localhost:5000/' : 'http://51.254.123.205:5000/'
|
||||
export const axiosInstance: AxiosInstance = axios.create({
|
||||
baseURL: API_URL,
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
axiosInstance.interceptors.response.use(
|
||||
(response) => {
|
||||
console.log(response)
|
||||
return response
|
||||
},
|
||||
(error) => {
|
||||
console.log(error.response.status)
|
||||
console.log('Request Error: ', error.response)
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export const addAuthHeaders = () => {
|
||||
// axiosInstance.defaults.headers.Authorization = `Bearer ${LoginModule.state.userInfos.userToken}`
|
||||
}
|
||||
|
||||
export const removeAuthHeaders = () => {
|
||||
delete axiosInstance.defaults.headers.Authorization
|
||||
}
|
||||
|
||||
async function Request(type: string, path: string, payload: any, noAuth?: boolean): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
try {
|
||||
console.log(`Axios Request [${type}]:`, axiosInstance.defaults)
|
||||
let response: AxiosResponse
|
||||
if (type === 'post' || type === 'put') {
|
||||
response = await axiosInstance[type](path, payload, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
console.log(new Types.AxiosSuccess(response.data))
|
||||
return new Types.AxiosSuccess(response.data)
|
||||
} else if (type === 'get' || type === 'delete') {
|
||||
// @ts-ignore
|
||||
response = await axiosInstance[type](path, {
|
||||
params: payload,
|
||||
headers: {'Content-Type': 'application/json'}
|
||||
})
|
||||
return new Types.AxiosSuccess(response.data)
|
||||
} else if (type === 'postFormData') {
|
||||
response = await axiosInstance.post(path, payload, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
return new Types.AxiosSuccess(response.data)
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error.response) {
|
||||
return Promise.reject(new Types.AxiosError(error.response.status, error.response.data))
|
||||
} else {
|
||||
return Promise.reject(new Types.AxiosError(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Request
|
||||
42
src/store/Api/index.ts
Normal file
42
src/store/Api/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import Request from './Instance'
|
||||
import sendRequest from './Inst-Pao'
|
||||
export * from './ApiTypes'
|
||||
import axios from 'axios'
|
||||
export {addAuthHeaders, removeAuthHeaders, API_URL, APP_BASE} from './Instance'
|
||||
// import {AlgoliaSearch} from './AlgoliaController'
|
||||
import Paths from '@paths'
|
||||
|
||||
|
||||
// const algoliaApi = new AlgoliaSearch()
|
||||
export namespace ApiTool {
|
||||
export async function post(path: string, payload?: any) {
|
||||
return await Request('post', path, payload)
|
||||
}
|
||||
export async function postFormData(path: string, payload?: any) {
|
||||
return await Request('postFormData', path, payload)
|
||||
}
|
||||
export async function get(path: string, payload?: any) {
|
||||
return await Request('get', path, payload)
|
||||
}
|
||||
export async function put(path: string, payload?: any) {
|
||||
return await Request('put', path, payload)
|
||||
}
|
||||
export async function Delete(path: string, payload: any) {
|
||||
return await Request('delete', path, payload)
|
||||
}
|
||||
export async function checkSession({token, refresh_token}) {
|
||||
return await axios.post(process.env.API_URL + Paths.TOKEN_REFRESH, {
|
||||
refresh_token
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function SendReq(url: string, lang: string, mytok: string, method: string, mydata: any) {
|
||||
return await sendRequest(url, lang, mytok, method, mydata)
|
||||
}
|
||||
|
||||
}
|
||||
export default ApiTool
|
||||
7
src/store/Modules/Store/Store.ts
Normal file
7
src/store/Modules/Store/Store.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import Vuex, { Store } from 'vuex'
|
||||
import Vue from 'vue'
|
||||
import {RootState} from '@store'
|
||||
import { getStoreBuilder } from 'vuex-typex'
|
||||
Vue.use(Vuex)
|
||||
|
||||
export const storeBuilder = getStoreBuilder<RootState>()
|
||||
96
src/store/Modules/glob.ts
Normal file
96
src/store/Modules/glob.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
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,
|
||||
layoutNeeded: true,
|
||||
mobileMode: false,
|
||||
menuCollapse: true,
|
||||
posts: []
|
||||
}
|
||||
|
||||
const b = storeBuilder.module<IGlobalState>('GlobalModule', state)
|
||||
const stateGetter = b.state()
|
||||
|
||||
// Getters
|
||||
namespace Getters {
|
||||
|
||||
const getConta = b.read(function getConta(state: IGlobalState): number {
|
||||
return state.conta
|
||||
})
|
||||
|
||||
const getIsLoginPage = b.read(function getIsLoginPage(state: IGlobalState): boolean {
|
||||
return state.isLoginPage
|
||||
})
|
||||
|
||||
const getLayoutNeeded = b.read(function getLayoutNeeded(state: IGlobalState): boolean {
|
||||
return state.layoutNeeded
|
||||
})
|
||||
|
||||
const getMobileMode = b.read(function getMobileMode(state: IGlobalState): boolean {
|
||||
return state.mobileMode
|
||||
})
|
||||
|
||||
const getMenuCollapse = b.read(function getMenuCollapse(state: IGlobalState): boolean {
|
||||
return state.menuCollapse
|
||||
})
|
||||
|
||||
const getPosts = b.read(function getPosts(state: IGlobalState): boolean {
|
||||
return state.posts
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
get getConta() { return getConta() },
|
||||
get getIsLoginPage() { return getIsLoginPage() },
|
||||
get getLayoutNeeded() { return getLayoutNeeded() },
|
||||
get getMobileMode() { return getMobileMode() },
|
||||
get getMenuCollapse() { return getMenuCollapse() },
|
||||
get getPosts() { return getPosts() }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Mutations {
|
||||
|
||||
function setConta(state: IGlobalState, num: number) {
|
||||
state.conta = num
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
setConta: b.commit(setConta)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Actions {
|
||||
async function setConta(num: number) {
|
||||
Mutations.mutations.setConta(num)
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
setConta: b.dispatch(setConta)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Module
|
||||
const GlobalModule = {
|
||||
get state() { return stateGetter()},
|
||||
getters: Getters.getters,
|
||||
mutations: Mutations.mutations,
|
||||
actions: Actions.actions
|
||||
}
|
||||
|
||||
|
||||
export default GlobalModule
|
||||
|
||||
2
src/store/Modules/index.ts
Normal file
2
src/store/Modules/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export {storeBuilder} from './Store/Store'
|
||||
export {default as User} from './user'
|
||||
@@ -6,5 +6,5 @@ export const serv_constants = {
|
||||
|
||||
RIS_CODE_LOGIN_ERR_GENERIC: -20,
|
||||
RIS_CODE_LOGIN_ERR: -10,
|
||||
RIS_CODE_LOGIN_OK: 1,
|
||||
};
|
||||
RIS_CODE_LOGIN_OK: 1
|
||||
}
|
||||
@@ -3,15 +3,21 @@ import Vuex from 'vuex'
|
||||
|
||||
import { Module, VuexModule, Mutation, MutationAction, Action, getModule } from 'vuex-module-decorators'
|
||||
import {Route} from 'vue-router'
|
||||
import store from '@/store'
|
||||
|
||||
import Api from '@api'
|
||||
|
||||
const bcrypt = require('bcryptjs')
|
||||
|
||||
import * as types from '@/store/mutation-types'
|
||||
import { serv_constants } from '@/store/modules/serv_constants'
|
||||
import * as types from 'store/mutation-types'
|
||||
import { serv_constants } from 'store/Modules/serv_constants'
|
||||
|
||||
import { ISignupOptions, IUserState } from '@/model'
|
||||
import { ILinkReg, IResult, IIdToken } from '@/model/other'
|
||||
import router from '@router'
|
||||
|
||||
import { storeBuilder } from '@store'
|
||||
|
||||
|
||||
import { ISignupOptions, IUserState } from 'model'
|
||||
import { ILinkReg, IResult, IIdToken } from 'model/other'
|
||||
|
||||
|
||||
export const ErroriMongoDb = {
|
||||
@@ -24,113 +30,154 @@ export const ErroriMongoDb = {
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
@Module({ dynamic: true, store, name: 'user' })
|
||||
class User extends VuexModule implements IUserState { // Non occorrono i getters, basta questi qui:
|
||||
_id: IUserState['_id'] = ''
|
||||
email: IUserState['email'] = ''
|
||||
username: IUserState['username'] = ''
|
||||
idapp: IUserState['idapp'] = process.env.APP_ID
|
||||
password: IUserState['password'] = ''
|
||||
lang: IUserState['lang'] = ''
|
||||
repeatPassword: IUserState['repeatPassword'] = ''
|
||||
idToken: IUserState['idToken'] = ''
|
||||
userId: IUserState['userId'] = 0
|
||||
tokens: IUserState['tokens'] = []
|
||||
verifiedEmail: IUserState['verifiedEmail'] = false
|
||||
servercode: number = 0
|
||||
const initialState: IUserState = {
|
||||
_id: '',
|
||||
email: '',
|
||||
username: '',
|
||||
idapp: process.env.APP_ID,
|
||||
password: '',
|
||||
lang: '',
|
||||
repeatPassword: '',
|
||||
idToken: '',
|
||||
userId: 0,
|
||||
tokens: [],
|
||||
verifiedEmail: false
|
||||
}
|
||||
|
||||
getlang() {
|
||||
if (this.lang !== '') {
|
||||
return this.lang
|
||||
// State
|
||||
const state = {...initialState}
|
||||
|
||||
const b = storeBuilder.module<IUserState>('UserModule', state)
|
||||
const stateGetter = b.state()
|
||||
|
||||
namespace Getters {
|
||||
const lang = b.read(function lang(state): string {
|
||||
if (state.lang !== '') {
|
||||
return state.lang
|
||||
} else {
|
||||
return process.env.LANG_DEFAULT
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
sendRequest (url: string, method: string, mydata: any) {
|
||||
console.log('LANG ' + this.getlang())
|
||||
let mytok: string = this.getTok()
|
||||
|
||||
const authHeader = new Headers()
|
||||
authHeader.append('content-type', 'application/json')
|
||||
authHeader.append('x-auth', mytok)
|
||||
authHeader.append('accept-language', this.getlang())
|
||||
const configInit: RequestInit = {
|
||||
method: method,
|
||||
cache: 'no-cache',
|
||||
body: JSON.stringify(mydata),
|
||||
headers: authHeader
|
||||
}
|
||||
|
||||
const request: Promise<Response> = fetch(url, configInit)
|
||||
return request
|
||||
|
||||
}
|
||||
|
||||
getTok () {
|
||||
if (this.tokens) {
|
||||
if (typeof this.tokens[0] !== 'undefined') {
|
||||
return this.tokens[0].token
|
||||
const tok = b.read(function tok(state): string {
|
||||
if (state.tokens) {
|
||||
if (typeof state.tokens[0] !== 'undefined') {
|
||||
return state.tokens[0].token
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
get lang() {
|
||||
return lang()
|
||||
},
|
||||
get tok() {
|
||||
return tok()
|
||||
}
|
||||
}
|
||||
|
||||
@MutationAction({ mutate: [types.USER_PASSWORD] })
|
||||
async setpassword (newstr: string) {
|
||||
return { password: newstr }
|
||||
}
|
||||
|
||||
@MutationAction({ mutate: [types.USER_EMAIL] })
|
||||
async setemail (newstr: string) {
|
||||
return { email: newstr }
|
||||
}
|
||||
|
||||
@MutationAction({ mutate: [types.USER_LANG] })
|
||||
async setlang (newstr: string) {
|
||||
return { lang: newstr }
|
||||
}
|
||||
|
||||
@Mutation
|
||||
authUser (data: IUserState) {
|
||||
this.username = data.username
|
||||
this.userId = data.userId
|
||||
this.idToken = data.idToken
|
||||
this.verifiedEmail = data.verifiedEmail
|
||||
namespace Mutations {
|
||||
function authUser(state, data: IUserState) {
|
||||
state.username = data.username
|
||||
state.userId = data.userId
|
||||
state.idToken = data.idToken
|
||||
state.verifiedEmail = data.verifiedEmail
|
||||
// @ts-ignore
|
||||
this.tokens = [
|
||||
state.tokens = [
|
||||
{ access: 'auth', token: data.idToken }
|
||||
]
|
||||
}
|
||||
|
||||
@Mutation
|
||||
UpdatePwd (data: IIdToken) {
|
||||
this.idToken = data.idToken
|
||||
if (!this.tokens) {
|
||||
this.tokens = []
|
||||
}
|
||||
this.tokens.push({ access: 'auth', token: data.idToken })
|
||||
function setpassword(state: IUserState, newstr: string) {
|
||||
state.password = newstr
|
||||
}
|
||||
|
||||
@Mutation
|
||||
setServerCode (servercode: number) {
|
||||
this.servercode = servercode
|
||||
function setemail(state: IUserState, newstr: string) {
|
||||
state.email = newstr
|
||||
}
|
||||
|
||||
@Mutation
|
||||
clearAuthData (): void {
|
||||
this.username = ''
|
||||
this.tokens = []
|
||||
this.idToken = ''
|
||||
this.userId = 0
|
||||
this.verifiedEmail = false
|
||||
function setlang(state: IUserState, newstr: string) {
|
||||
state.lang = newstr
|
||||
}
|
||||
|
||||
@Action({ commit: types.USER_UPDATEPWD })
|
||||
resetpwd (paramquery: IUserState) {
|
||||
function UpdatePwd(state: IUserState, data: IIdToken) {
|
||||
state.idToken = data.idToken
|
||||
if (!state.tokens) {
|
||||
state.tokens = []
|
||||
}
|
||||
state.tokens.push({ access: 'auth', token: data.idToken })
|
||||
}
|
||||
|
||||
function setServerCode(state: IUserState, num: number) {
|
||||
state.servercode = num
|
||||
}
|
||||
|
||||
function clearAuthData(state: IUserState) {
|
||||
state.username = ''
|
||||
state.tokens = []
|
||||
state.idToken = ''
|
||||
state.userId = 0
|
||||
state.verifiedEmail = false
|
||||
}
|
||||
|
||||
function autologin (state: IUserState) {
|
||||
const token = localStorage.getItem('token')
|
||||
if (!token) {
|
||||
return
|
||||
}
|
||||
const expirationDateStr = localStorage.getItem('expirationDate')
|
||||
let expirationDate = new Date(String(expirationDateStr))
|
||||
const now = new Date()
|
||||
if (now >= expirationDate) {
|
||||
return
|
||||
}
|
||||
const userId = Number(localStorage.getItem('userId'))
|
||||
const username = String(localStorage.getItem('username'))
|
||||
const verifiedEmail = localStorage.getItem('verificato') === '1'
|
||||
|
||||
mutations.authUser({
|
||||
username: username,
|
||||
userId: userId,
|
||||
idToken: token,
|
||||
verifiedEmail: verifiedEmail
|
||||
})
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
authUser: b.commit(authUser),
|
||||
setpassword: b.commit(setpassword),
|
||||
setemail: b.commit(setemail),
|
||||
setlang: b.commit(setlang),
|
||||
UpdatePwd: b.commit(UpdatePwd),
|
||||
setServerCode: b.commit(setServerCode),
|
||||
clearAuthData: b.commit(clearAuthData),
|
||||
autologin: b.commit(autologin)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Actions {
|
||||
|
||||
async function sendUserEdit(context, form: Object) {
|
||||
try {
|
||||
const {data} = await Api.postFormData('profile/edit', form)
|
||||
console.log(data)
|
||||
// return new ApiSuccess({data})
|
||||
|
||||
} catch {
|
||||
// return new ApiError()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function resetpwd (paramquery: IUserState) {
|
||||
let call = process.env.MONGODB_HOST + '/updatepwd'
|
||||
console.log('CALL ' + call)
|
||||
|
||||
@@ -143,13 +190,13 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
}
|
||||
console.log(usertosend)
|
||||
|
||||
this.setServerCode(ErroriMongoDb.CALLING)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.CALLING)
|
||||
|
||||
let myres
|
||||
|
||||
let x_auth_token: string = ''
|
||||
|
||||
return this.sendRequest(call, 'POST', usertosend)
|
||||
return Api.SendReq(call, state.lang, Getters.getters.tok, 'POST', usertosend)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
myres = res
|
||||
@@ -157,25 +204,24 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
if (myres.status === 200) {
|
||||
return myres.json()
|
||||
}
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore: ' + myres.status, resetpwd: true }
|
||||
|
||||
})
|
||||
.then((body) => {
|
||||
this.UpdatePwd({ idToken: x_auth_token })
|
||||
Mutations.mutations.UpdatePwd({ idToken: x_auth_token })
|
||||
localStorage.setItem('token', x_auth_token)
|
||||
|
||||
return { code: body.code, msg: body.msg }
|
||||
}).catch((err) => {
|
||||
console.log('ERROR: ' + err)
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore' }
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@Action({ commit: types.USER_REQUESTRESETPWD })
|
||||
requestpwd (paramquery: IUserState) {
|
||||
async function requestpwd (paramquery: IUserState) {
|
||||
|
||||
let call = process.env.MONGODB_HOST + '/requestnewpwd'
|
||||
console.log('CALL ' + call)
|
||||
@@ -187,18 +233,18 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
}
|
||||
console.log(usertosend)
|
||||
|
||||
this.setServerCode(ErroriMongoDb.CALLING)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.CALLING)
|
||||
|
||||
let myres
|
||||
|
||||
return this.sendRequest(call, 'POST', usertosend)
|
||||
return Api.SendReq(call, state.lang, Getters.getters.tok, 'POST', usertosend)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
myres = res
|
||||
if (myres.status === 200) {
|
||||
return myres.json()
|
||||
}
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore: ' + myres.status, resetpwd: true }
|
||||
|
||||
})
|
||||
@@ -206,14 +252,13 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
return { code: body.code, msg: body.msg }
|
||||
}).catch((err) => {
|
||||
console.log('ERROR: ' + err)
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore' }
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@Action({ commit: types.USER_VREG })
|
||||
vreg (paramquery: ILinkReg) {
|
||||
async function vreg (paramquery: ILinkReg) {
|
||||
let call = process.env.MONGODB_HOST + '/vreg'
|
||||
console.log('CALL ' + call)
|
||||
|
||||
@@ -224,43 +269,42 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
}
|
||||
console.log(usertosend)
|
||||
|
||||
this.setServerCode(ErroriMongoDb.CALLING)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.CALLING)
|
||||
|
||||
let myres
|
||||
|
||||
return this.sendRequest(call, 'POST', usertosend)
|
||||
return Api.SendReq(call, state.lang, Getters.getters.tok, 'POST', usertosend)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
myres = res
|
||||
if (myres.status === 200) {
|
||||
return myres.json()
|
||||
}
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore: ' + myres.status }
|
||||
|
||||
})
|
||||
.then((body) => {
|
||||
// console.log("RITORNO 2 ");
|
||||
// this.setServerCode(myres);
|
||||
// mutations.setServerCode(myres);
|
||||
if (body.code === serv_constants.RIS_CODE_EMAIL_VERIFIED) {
|
||||
localStorage.setItem('verificato', '1')
|
||||
}
|
||||
return { code: body.code, msg: body.msg }
|
||||
}).catch((err) => {
|
||||
console.log('ERROR: ' + err)
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return { code: ErroriMongoDb.ERR_GENERICO, msg: 'Errore' }
|
||||
})
|
||||
}
|
||||
|
||||
@Action({ commit: types.USER_SIGNUP })
|
||||
signup (authData: ISignupOptions) {
|
||||
async function signup (authData: ISignupOptions) {
|
||||
let call = process.env.MONGODB_HOST + '/users'
|
||||
console.log('CALL ' + call)
|
||||
|
||||
// console.log("PASSW: " + authData.password);
|
||||
|
||||
let mylang = this.getlang()
|
||||
let mylang = state.lang
|
||||
console.log('MYLANG: ' + mylang)
|
||||
|
||||
return bcrypt.hash(authData.password, bcrypt.genSaltSync(12))
|
||||
@@ -278,11 +322,11 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
|
||||
let myres: IResult
|
||||
|
||||
this.setServerCode(ErroriMongoDb.CALLING)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.CALLING)
|
||||
|
||||
let x_auth_token: string = ''
|
||||
|
||||
return this.sendRequest(call, 'POST', usertosend)
|
||||
return Api.SendReq(call, state.lang, Getters.getters.tok, 'POST', usertosend)
|
||||
.then((res) => {
|
||||
myres = res
|
||||
x_auth_token = String(res.headers.get('x-auth'))
|
||||
@@ -300,7 +344,7 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
console.log(body)
|
||||
}
|
||||
|
||||
this.setServerCode(myres.status)
|
||||
Mutations.mutations.setServerCode(myres.status)
|
||||
|
||||
if (myres.status === 200) {
|
||||
let iduser = body._id
|
||||
@@ -310,7 +354,7 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
console.log('IDUSER= ' + iduser)
|
||||
}
|
||||
|
||||
this.authUser({
|
||||
Mutations.mutations.authUser({
|
||||
username: username,
|
||||
userId: iduser,
|
||||
idToken: x_auth_token,
|
||||
@@ -346,36 +390,35 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
console.log('ERROREEEEEEEEE')
|
||||
console.log(error)
|
||||
}
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return ErroriMongoDb.ERR_GENERICO
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@Action({ commit: types.USER_SIGNIN })
|
||||
signin (authData: ISignupOptions) {
|
||||
async function signin (authData: ISignupOptions) {
|
||||
let call = process.env.MONGODB_HOST + '/users/login'
|
||||
console.log('LOGIN ' + call)
|
||||
|
||||
console.log('MYLANG = ' + this.getlang())
|
||||
console.log('MYLANG = ' + state.lang)
|
||||
|
||||
const usertosend = {
|
||||
username: authData.username,
|
||||
password: authData.password,
|
||||
idapp: process.env.APP_ID,
|
||||
keyappid: process.env.PAO_APP_ID,
|
||||
lang: this.getlang()
|
||||
lang: state.lang
|
||||
}
|
||||
|
||||
console.log(usertosend)
|
||||
|
||||
let myres: IResult
|
||||
|
||||
this.setServerCode(ErroriMongoDb.CALLING)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.CALLING)
|
||||
|
||||
let x_auth_token: string = ''
|
||||
|
||||
return this.sendRequest(call, 'POST', usertosend)
|
||||
return Api.SendReq(call, state.lang, Getters.getters.tok, 'POST', usertosend)
|
||||
.then((res) => {
|
||||
myres = res
|
||||
x_auth_token = String(res.headers.get('x-auth'))
|
||||
@@ -396,11 +439,11 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
}
|
||||
|
||||
if (body.code === serv_constants.RIS_CODE_LOGIN_ERR) {
|
||||
this.setServerCode(body.code)
|
||||
Mutations.mutations.setServerCode(body.code)
|
||||
return body.code
|
||||
}
|
||||
|
||||
this.setServerCode(myres.status)
|
||||
Mutations.mutations.setServerCode(myres.status)
|
||||
|
||||
if (myres.status === 200) {
|
||||
let iduser = body._id
|
||||
@@ -409,7 +452,7 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
if (process.env.DEV) {
|
||||
console.log('USERNAME = ' + username)
|
||||
console.log('IDUSER= ' + iduser)
|
||||
this.authUser({
|
||||
Mutations.mutations.authUser({
|
||||
username: username,
|
||||
userId: iduser,
|
||||
idToken: x_auth_token,
|
||||
@@ -447,36 +490,12 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
console.log('ERROREEEEEEEEE')
|
||||
console.log(error)
|
||||
}
|
||||
this.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
Mutations.mutations.setServerCode(ErroriMongoDb.ERR_GENERICO)
|
||||
return ErroriMongoDb.ERR_GENERICO
|
||||
})
|
||||
}
|
||||
|
||||
@Mutation
|
||||
autologin () {
|
||||
const token = localStorage.getItem('token')
|
||||
if (!token) {
|
||||
return
|
||||
}
|
||||
const expirationDateStr = localStorage.getItem('expirationDate')
|
||||
let expirationDate = new Date(String(expirationDateStr))
|
||||
const now = new Date()
|
||||
if (now >= expirationDate) {
|
||||
return
|
||||
}
|
||||
const userId = Number(localStorage.getItem('userId'))
|
||||
const username = String(localStorage.getItem('username'))
|
||||
const verifiedEmail = localStorage.getItem('verificato') === '1'
|
||||
this.authUser({
|
||||
username: username,
|
||||
userId: userId,
|
||||
idToken: token,
|
||||
verifiedEmail: verifiedEmail
|
||||
})
|
||||
}
|
||||
|
||||
@Action({ commit: types.USER_LOGOUT })
|
||||
logout () {
|
||||
async function logout () {
|
||||
|
||||
let call = process.env.MONGODB_HOST + '/users/me/token'
|
||||
console.log('CALL ' + call)
|
||||
@@ -487,7 +506,7 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
}
|
||||
|
||||
console.log(usertosend)
|
||||
this.sendRequest(call, 'DELETE', usertosend)
|
||||
Api.SendReq(call, state.lang, Getters.getters.tok, 'DELETE', usertosend)
|
||||
.then(
|
||||
(res) => {
|
||||
console.log(res)
|
||||
@@ -495,7 +514,7 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
).catch((err) => {
|
||||
console.log('ERROR: ' + err)
|
||||
}).then(() => {
|
||||
this.clearAuthData()
|
||||
Mutations.mutations.clearAuthData()
|
||||
})
|
||||
|
||||
localStorage.removeItem('expirationDate')
|
||||
@@ -505,9 +524,29 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
|
||||
localStorage.removeItem('isLoggedin')
|
||||
localStorage.removeItem('verifiedEmail')
|
||||
|
||||
// router.replace('/signin')
|
||||
router.push('/signin')
|
||||
}
|
||||
|
||||
|
||||
export const actions = {
|
||||
resetpwd: b.dispatch(resetpwd),
|
||||
requestpwd: b.dispatch(requestpwd),
|
||||
vreg: b.dispatch(vreg),
|
||||
signup: b.dispatch(signup),
|
||||
signin: b.dispatch(signin),
|
||||
logout: b.dispatch(logout)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const UserModule = getModule(User.prototype)
|
||||
// Module
|
||||
const UserModule = {
|
||||
get state() {
|
||||
return stateGetter()
|
||||
},
|
||||
getters: Getters.getters,
|
||||
mutations: Mutations.mutations,
|
||||
actions: Actions.actions
|
||||
}
|
||||
|
||||
export default UserModule
|
||||
@@ -1,16 +1,22 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import { IUserState, IGlobState } from '@/model'
|
||||
import { IUserState, IGlobState } from 'model'
|
||||
import {Route} from 'vue-router'
|
||||
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export interface IRootState {
|
||||
export interface RootState {
|
||||
user: IUserState
|
||||
glob: IGlobState
|
||||
role: IRootState
|
||||
route: Route
|
||||
}
|
||||
|
||||
const store = new Vuex.Store<IRootState>({})
|
||||
// const store = new Vuex.Store<IRootState>({})
|
||||
|
||||
export default store
|
||||
// export default store
|
||||
|
||||
export * from './Modules'
|
||||
// export {default as EventBus} from './EventBus';
|
||||
export {default as Api} from './Api'
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import { Module, VuexModule, Mutation, MutationAction, Action, getModule } from 'vuex-module-decorators'
|
||||
|
||||
import * as types from '@/store/mutation-types'
|
||||
|
||||
import store from '@/store'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
|
||||
@Module({ dynamic: true, store, name: 'glob' })
|
||||
class Glob extends VuexModule { // Non occorrono i getters, basta questi qui:
|
||||
conta = 0
|
||||
isLoginPage = false
|
||||
layoutNeeded = true
|
||||
mobileMode = false
|
||||
menuCollapse = true
|
||||
posts = []
|
||||
|
||||
getConta() {
|
||||
return this.conta
|
||||
}
|
||||
|
||||
getIsLoginPage() {
|
||||
return this.isLoginPage
|
||||
}
|
||||
|
||||
getLayoutNeeded() {
|
||||
return this.layoutNeeded
|
||||
}
|
||||
|
||||
getMobileMode() {
|
||||
return this.mobileMode
|
||||
}
|
||||
|
||||
getMenuCollapse() {
|
||||
return this.menuCollapse
|
||||
}
|
||||
|
||||
getPosts() {
|
||||
return this.posts
|
||||
}
|
||||
|
||||
@MutationAction({ mutate: ['conta'] })
|
||||
async setConta(num: number) {
|
||||
return { conta: num }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const GlobModule = getModule(Glob.prototype)
|
||||
8
src/typings/GlobalState.d.ts
vendored
Normal file
8
src/typings/GlobalState.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface IGlobalState {
|
||||
conta: number,
|
||||
isLoginPage: boolean,
|
||||
layoutNeeded: boolean,
|
||||
mobileMode: boolean,
|
||||
menuCollapse: boolean,
|
||||
posts: Array
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
// export * from './LoginState';
|
||||
|
||||
export * from './GlobalState.d'
|
||||
|
||||
|
||||
|
||||
export interface IResponse<T> {
|
||||
success?: boolean,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import Cookies from 'js-cookie';
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const TokenKey = 'Admin-Token';
|
||||
const TokenKey = 'Admin-Token'
|
||||
|
||||
export function getToken() {
|
||||
return Cookies.get(TokenKey);
|
||||
return Cookies.get(TokenKey)
|
||||
}
|
||||
|
||||
export function setToken(token: string) {
|
||||
return Cookies.set(TokenKey, token);
|
||||
return Cookies.set(TokenKey, token)
|
||||
}
|
||||
|
||||
export function removeToken() {
|
||||
return Cookies.remove(TokenKey);
|
||||
return Cookies.remove(TokenKey)
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
|
||||
import {mapActions} from 'vuex'
|
||||
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';
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
import {mapGetters, mapActions} from 'vuex'
|
||||
import * as types from '../../store/mutation-types'
|
||||
|
||||
//import {ErroriMongoDb} from '../../store/modules/user'
|
||||
import {serv_constants} from "../../store/modules/serv_constants";
|
||||
//import {ErroriMongoDb} from '../../store/Modules/user'
|
||||
import {serv_constants} from "../../store/Modules/serv_constants";
|
||||
import axios from 'axios';
|
||||
|
||||
import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Prop, Watch } from 'vue-property-decorator'
|
||||
import { UserModule } from '@/store/modules/user'
|
||||
import { ErroriMongoDb } from '@/store/modules/user'
|
||||
import { User } from '@store'
|
||||
import { ErroriMongoDb } from 'store/Modules/user'
|
||||
|
||||
import { required, email, numeric, maxLength, maxValue, minValue, sameAs, minLength } from 'vuelidate/lib/validators'
|
||||
import { ISignupOptions, IUserState } from '@/model'
|
||||
import { ISignupOptions, IUserState } from 'model'
|
||||
import { validations, TSignup } from './signup-validate'
|
||||
|
||||
import { validationMixin } from 'vuelidate'
|
||||
@@ -162,7 +162,7 @@ export default class Signup extends Vue {
|
||||
this.$q.loading.show({ message: this.$t('reg.incorso') })
|
||||
|
||||
console.log(this.signup)
|
||||
UserModule.signup(this.signup)
|
||||
User.actions.signup(this.signup)
|
||||
.then((riscode) => {
|
||||
this.checkErrors(riscode)
|
||||
this.$q.loading.hide()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue, Watch } from 'vue-property-decorator';
|
||||
import { UserModule } from '../../store/modules/user';
|
||||
import { UserModule } from '../../store/Modules/user';
|
||||
|
||||
|
||||
@Component({})
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
|
||||
import {mapActions} from 'vuex'
|
||||
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';
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
import {mapActions} from 'vuex'
|
||||
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';
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
@@ -21,14 +21,18 @@
|
||||
"es2017.object",
|
||||
"es7"
|
||||
],
|
||||
"baseUrl": ".",
|
||||
"baseUrl": "./src",
|
||||
"paths": {
|
||||
"~/*": ["./*"],
|
||||
"@/*": ["src/*"],
|
||||
"@src/*": ["./*"],
|
||||
"@classes": ["./classes/index.ts"],
|
||||
"@types": ["./typings/index.ts"],
|
||||
"@utils/*": ["./utils/*"],
|
||||
"@validators": ["./utils/validators.ts"]
|
||||
"@validators": ["./utils/validators.ts"],
|
||||
"@router": ["./router/index.ts"],
|
||||
"@paths": ["./store/Api/ApiRoutes.ts"],
|
||||
"@types": ["./typings/index.ts"],
|
||||
"@store": ["./store/index.ts"],
|
||||
"@api": ["./store/Api/index.ts"],
|
||||
"@modules": ["./store/Modules/index.ts"]
|
||||
},
|
||||
"sourceMap": true,
|
||||
"allowJs": true,
|
||||
|
||||
Reference in New Issue
Block a user