- User Profile

- DashBoard start
This commit is contained in:
Paolo Arena
2019-12-29 23:29:56 +01:00
parent cf91d45427
commit 9e5bd85328
23 changed files with 516 additions and 201 deletions

View File

@@ -34,8 +34,10 @@ const DefaultUser: IUserFields = {
}
}
const DefaultProfile: IUserProfile = {
export const DefaultProfile: IUserProfile = {
img: '',
nationality: '',
intcode_cell: '',
cell: '',
dateofbirth: new Date(),
sex: 0,
@@ -516,6 +518,7 @@ namespace Actions {
return bcrypt.hash(authData.password, bcrypt.genSaltSync(12))
.then((hashedPassword: string) => {
/*
const usertosend = {
lang: mylang,
email: authData.email,
@@ -524,12 +527,15 @@ namespace Actions {
name: authData.name,
surname: authData.surname
}
console.log(usertosend)
*/
authData.lang = mylang
authData.password = String(hashedPassword)
Mutations.mutations.setServerCode(tools.CALLING)
return Api.SendReq('/users', 'POST', usertosend)
return Api.SendReq('/users', 'POST', authData)
.then((res) => {
const newuser = res.data
@@ -569,6 +575,7 @@ namespace Actions {
}
})
.catch((error) => {
console.log('Err', error)
UserStore.mutations.setErrorCatch(error)
return UserStore.getters.getServerCode
})

View File

@@ -378,7 +378,10 @@ export const fieldsTable = {
AddCol({ name: 'name', label_trans: 'reg.name' }),
AddCol({ name: 'surname', label_trans: 'reg.surname' }),
AddCol({ name: 'email', label_trans: 'reg.email' }),
AddCol({ name: 'profile.cell', field: 'profile', subfield: 'cell', label_trans: 'reg.cell' }),
AddCol({ name: 'profile.nationality', field: 'profile', subfield: 'nationality', label_trans: 'reg.nationality', fieldtype: tools.FieldType.nationality }),
AddCol({ name: 'profile.intcode_cell', field: 'profile', subfield: 'intcode_cell', label_trans: 'reg.intcode_cell', fieldtype: tools.FieldType.intcode }),
AddCol({ name: 'profile.iso2_cell', field: 'profile', subfield: 'iso2_cell', label_trans: 'reg.iso2_cell' }),
AddCol({ name: 'profile.cell', field: 'profile', subfield: 'cell', label_trans: 'reg.cell', fieldtype: tools.FieldType.intcode }),
AddCol({ name: 'profile.email_paypal', field: 'profile', subfield: 'email_paypal', label_trans: 'reg.email_paypal' }),
AddCol({ name: 'profile.username_telegram', field: 'profile', subfield: 'username_telegram', label_trans: 'reg.username_telegram' }),
AddCol({ name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }),

View File

@@ -5,6 +5,10 @@ export const serv_constants = {
RIS_CODE_ERR: -99,
RIS_CODE_EMAIL_ALREADY_VERIFIED: -5,
RIS_CODE_EMAIL_VERIFIED: 1,
RIS_CODE_USERNAME_ALREADY_EXIST: -60,
RIS_CODE_EMAIL_ALREADY_EXIST: -50,
RIS_CODE_EMAIL_NOT_SENT: -40,
RIS_CODE_ERR_UNAUTHORIZED: -30,
RIS_CODE_LOGIN_ERR_GENERIC: -20,

View File

@@ -47,6 +47,8 @@ export interface INotify {
export const tools = {
CAN_EDIT: 'q-ce',
getprefCountries: ['it', 'us', 'es', 'uk', 'fr', 'de', 'ch'],
APORTADOR_SOLIDARIO: 'apsol',
listBestColor: [
@@ -83,8 +85,6 @@ export const tools = {
ERR_GENERICO: -1,
ERR_SERVERFETCH: -2,
ERR_AUTHENTICATION: -5,
DUPLICATE_EMAIL_ID: 11000,
DUPLICATE_USERNAME_ID: 11100,
NOFIELD: 'nofield',
@@ -144,6 +144,8 @@ export const tools = {
password: 512,
listimages: 1024,
image: 2048,
nationality: 4096,
intcode: 5000,
},
FieldTypeArr: [
@@ -2572,9 +2574,9 @@ export const tools = {
SignUpcheckErrors(mythis, riscode: number) {
console.log('SignUpcheckErrors', riscode)
if (riscode === tools.DUPLICATE_EMAIL_ID) {
if (riscode === serv_constants.RIS_CODE_EMAIL_ALREADY_EXIST) {
tools.showNotif(mythis.$q, mythis.$t('reg.err.duplicate_email'))
} else if (riscode === tools.DUPLICATE_USERNAME_ID) {
} else if (riscode === serv_constants.RIS_CODE_USERNAME_ALREADY_EXIST) {
tools.showNotif(mythis.$q, mythis.$t('reg.err.duplicate_username'))
} else if (riscode === tools.ERR_SERVERFETCH) {
tools.showNotif(mythis.$q, mythis.$t('fetch.errore_server'))
@@ -2746,7 +2748,7 @@ export const tools = {
},
getCookie(mytok, def?) {
const ris = Cookies.get(mytok)
console.log('getCookie', ris)
// console.log('getCookie', ris)
if (!!ris) {
return ris
} else {