- verifica email se non è stata verificata (componente)
- altri aggiornamenti grafica PAGERIS. - OLLAMA AI
This commit is contained in:
@@ -50,7 +50,7 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
const account = userStore.my.profile.useraccounts.find(
|
||||
(rec: IAccount) => rec.circuitId === circuitId
|
||||
);
|
||||
if (account) return account.saldo;
|
||||
if (account) return tools.roundDec2(account.saldo, 2);
|
||||
else return 0;
|
||||
},
|
||||
|
||||
@@ -164,6 +164,24 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
getMaxAccumuloByUsername(
|
||||
myuser: IUserFields,
|
||||
circuitId: string,
|
||||
username: string,
|
||||
groupname?: string
|
||||
): number | string {
|
||||
if (myuser && myuser.profile.useraccounts) {
|
||||
const account = myuser.profile.useraccounts.find(
|
||||
(rec: IAccount) =>
|
||||
(rec.username === username ||
|
||||
(rec.groupname === groupname && groupname !== '')) &&
|
||||
rec.circuitId === circuitId
|
||||
);
|
||||
return account ? account.qta_maxConcessa : 0;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
SonoDentroAdAlmeno1CircuitoConFido(): boolean {
|
||||
const userStore = useUserStore();
|
||||
@@ -334,7 +352,7 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
return false;
|
||||
},
|
||||
|
||||
updateListCircuit(visu: number) {
|
||||
updateListCircuit(visu: number, sortbyuser?: boolean) {
|
||||
const userStore = useUserStore();
|
||||
|
||||
let arr: any[] = [];
|
||||
@@ -367,6 +385,31 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
}
|
||||
}
|
||||
|
||||
if (sortbyuser) {
|
||||
// Ordina i circuiti prima per quello provinciale, poi quello Italia, poi tutti gli altri
|
||||
const circuitiMiaProvincia = this.getCircuitsByProvince(
|
||||
userStore.my.profile.resid_province
|
||||
);
|
||||
|
||||
const circuitiNazionali = this.getCircuitsNational();
|
||||
|
||||
// Crea Set di ID per lookup veloce
|
||||
const provinciaIds = new Set(circuitiMiaProvincia.map((c) => c._id));
|
||||
const nazionaliIds = new Set(circuitiNazionali.map((c) => c._id));
|
||||
|
||||
// Filtra arr in tre gruppi (mantenendo solo elementi già presenti in arr)
|
||||
const fromProvincia = arr.filter((rec) => provinciaIds.has(rec._id));
|
||||
const fromNazionali = arr.filter(
|
||||
(rec) => nazionaliIds.has(rec._id) && !provinciaIds.has(rec._id)
|
||||
);
|
||||
const others = arr.filter(
|
||||
(rec) => !provinciaIds.has(rec._id) && !nazionaliIds.has(rec._id)
|
||||
);
|
||||
|
||||
// Ricomponi l'array nell'ordine desiderato
|
||||
arr = [...fromProvincia, ...fromNazionali, ...others];
|
||||
}
|
||||
|
||||
return arr;
|
||||
},
|
||||
|
||||
@@ -1420,5 +1463,15 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
|
||||
return str;
|
||||
},
|
||||
|
||||
getTypeCircuit(circuit: ICircuit) {
|
||||
if (circuit.isCircItalia) {
|
||||
return 'Nazionale';
|
||||
} else if (circuit.circuitoIndipendente) {
|
||||
return 'Indipendente';
|
||||
} else if (!circuit.circuitiExtraProv) {
|
||||
return 'Provinciale';
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -7464,92 +7464,97 @@ export const tools = {
|
||||
$router: any,
|
||||
circuit: ICircuit,
|
||||
sendcoinrec: ISendCoin
|
||||
) {
|
||||
): Promise<void> {
|
||||
const userStore = useUserStore();
|
||||
const notifStore = useNotifStore();
|
||||
//T_TOLTO
|
||||
const { username } = userStore.my;
|
||||
|
||||
const username = userStore.my.username;
|
||||
// Origine e destinazione con fallback chain più leggibile
|
||||
const orig = sendcoinrec.grouporig || sendcoinrec.contoComOrig || '';
|
||||
const dest = sendcoinrec.groupdest || sendcoinrec.contoComDest || sendcoinrec.dest;
|
||||
|
||||
const orig = sendcoinrec.grouporig
|
||||
? sendcoinrec.grouporig
|
||||
: sendcoinrec.contoComOrig
|
||||
? sendcoinrec.contoComOrig
|
||||
: '';
|
||||
const dest = sendcoinrec.groupdest
|
||||
? sendcoinrec.groupdest
|
||||
: sendcoinrec.contoComDest
|
||||
? sendcoinrec.contoComDest
|
||||
: sendcoinrec.dest;
|
||||
// Parametri comuni per i messaggi
|
||||
const msgParams = {
|
||||
coin: circuit.symbol,
|
||||
dest,
|
||||
qty: sendcoinrec.qty,
|
||||
circuit: circuit.name,
|
||||
...(orig && { from: orig }), // Aggiunge 'from' solo se esiste
|
||||
};
|
||||
|
||||
let msg = '';
|
||||
if (orig) {
|
||||
msg = t('circuit.question_sendcoinsto_from', {
|
||||
coin: circuit.symbol,
|
||||
from: orig,
|
||||
dest,
|
||||
qty: sendcoinrec.qty,
|
||||
});
|
||||
} else {
|
||||
msg = t('circuit.question_sendcoinsto', {
|
||||
coin: circuit.symbol,
|
||||
dest,
|
||||
qty: sendcoinrec.qty,
|
||||
});
|
||||
}
|
||||
// Seleziona il messaggio appropriato
|
||||
const messageKey = orig
|
||||
? 'circuit.question_sendcoinsto_from'
|
||||
: 'circuit.question_sendcoinsto';
|
||||
|
||||
return $q
|
||||
.dialog({
|
||||
message: msg,
|
||||
// Mostra dialog di conferma
|
||||
return new Promise((resolve, reject) => {
|
||||
$q.dialog({
|
||||
title: t('db.domanda'),
|
||||
message: t(messageKey, msgParams),
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
color: 'primary',
|
||||
push: true,
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel'),
|
||||
color: 'secondary',
|
||||
},
|
||||
title: t('db.domanda'),
|
||||
})
|
||||
.onOk(() => {
|
||||
return userStore
|
||||
.setCircuitCmd(
|
||||
$q,
|
||||
t,
|
||||
username,
|
||||
sendcoinrec.circuitname,
|
||||
shared_consts.CIRCUITCMD.SENDCOINS_REQ,
|
||||
true,
|
||||
sendcoinrec
|
||||
)
|
||||
.then((res: any) => {
|
||||
console.log('setCircuitCmd ', res);
|
||||
if (res && res.cansend) {
|
||||
if (res.useraccounts && res.useraccounts.length > 0) {
|
||||
userStore.my.profile.useraccounts = res.useraccounts;
|
||||
}
|
||||
$router.push('/circuits');
|
||||
tools.showPositiveNotif(
|
||||
$q,
|
||||
t('circuit.coins_sent', {
|
||||
qty: sendcoinrec.qty,
|
||||
symbol: circuit.symbol,
|
||||
dest,
|
||||
})
|
||||
);
|
||||
//tools.showPositiveNotif($q, t('circuit.coins_sendrequest_sent'))
|
||||
} else {
|
||||
tools.showNegativeNotif($q, res.errormsg);
|
||||
}
|
||||
notifStore.updateNotification = true;
|
||||
tools.updateMyData(res);
|
||||
});
|
||||
});
|
||||
.onOk(async () => {
|
||||
try {
|
||||
const res = await userStore.setCircuitCmd(
|
||||
$q,
|
||||
t,
|
||||
username,
|
||||
sendcoinrec.circuitname,
|
||||
shared_consts.CIRCUITCMD.SENDCOINS_REQ,
|
||||
true,
|
||||
sendcoinrec
|
||||
);
|
||||
|
||||
/* return await new Promise((resolve, reject) => {
|
||||
console.log('setCircuitCmd', res);
|
||||
|
||||
if (!res?.cansend) {
|
||||
tools.showNegativeNotif($q, res?.errormsg || t('errors.generic'));
|
||||
return resolve();
|
||||
}
|
||||
|
||||
// Aggiorna gli account utente se presenti
|
||||
if (res.useraccounts?.length > 0) {
|
||||
userStore.my.profile.useraccounts = res.useraccounts;
|
||||
}
|
||||
|
||||
// Aggiorna dati e naviga
|
||||
tools.updateMyData(res);
|
||||
notifStore.updateNotification = true;
|
||||
|
||||
tools.showPositiveNotif(
|
||||
$q,
|
||||
t('circuit.coins_sent', {
|
||||
qty: sendcoinrec.qty,
|
||||
symbol: circuit.symbol,
|
||||
dest,
|
||||
})
|
||||
);
|
||||
|
||||
$router.push('/circuits');
|
||||
resolve();
|
||||
} catch (error) {
|
||||
console.error('Errore invio coins:', error);
|
||||
tools.showNegativeNotif($q, t('errors.generic'));
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
.onCancel(() => resolve())
|
||||
.onDismiss(() => resolve());
|
||||
});
|
||||
},
|
||||
/* return await new Promise((resolve, reject) => {
|
||||
resolve(false)
|
||||
})
|
||||
*/
|
||||
},
|
||||
|
||||
cancelReqCircuit($q: any, username: string, circuitname: string, groupname?: string) {
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
ISignupIscrizioneConacreisOptions,
|
||||
IMovQuery,
|
||||
IGroup,
|
||||
IMovVisu,
|
||||
} from '@/model';
|
||||
import { IFriends, ISettings } from '@/model';
|
||||
import { tools } from '@tools';
|
||||
@@ -805,6 +806,10 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return this.my.profile.teleg_id! > 0 || this.my.profile.teleg_id_old! > 0;
|
||||
},
|
||||
|
||||
isEmailVerified() {
|
||||
return this.my.verified_email;
|
||||
},
|
||||
|
||||
isUserOk(anchesenonammesso: boolean = false): boolean {
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
@@ -828,7 +833,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.isUsernameTelegOk()
|
||||
);
|
||||
} else {
|
||||
return this.my.verified_email!;
|
||||
return this.my.verified_email! || this.isTelegIdOk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1028,7 +1033,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
mydata.password = String(hashedPassword);
|
||||
|
||||
return Api.SendReq('/updatepwd', 'POST', mydata, true, false, 1)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return { code: res.data.code, msg: res.data.msg };
|
||||
})
|
||||
.catch((error: Types.AxiosError) => {
|
||||
@@ -1057,7 +1062,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/setlang', 'PATCH', { data: mydata })
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
return res.data.code === serv_constants.RIS_CODE_OK;
|
||||
}
|
||||
@@ -1076,8 +1081,8 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.setServerCode(tools.CALLING);
|
||||
|
||||
return Api.SendReq('/requestnewpwd', 'POST', usertosend)
|
||||
.then((res) => ({ code: res.data.code, msg: res.data.msg, link: res.data.link }))
|
||||
.catch((error) => {
|
||||
.then((res: any) => ({ code: res.data.code, msg: res.data.msg, link: res.data.link }))
|
||||
.catch((error: any) => {
|
||||
this.setErrorCatch(error);
|
||||
return this.getServerCode;
|
||||
});
|
||||
@@ -1094,12 +1099,12 @@ export const useUserStore = defineStore('UserStore', {
|
||||
paramquery.password = String(hashedPassword);
|
||||
|
||||
return Api.SendReq('/addNewSite', 'POST', paramquery)
|
||||
.then((res) => ({
|
||||
.then((res: any) => ({
|
||||
code: res.data.code,
|
||||
msg: res.data.msg,
|
||||
idapp: res.data.idapp,
|
||||
}))
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
this.setErrorCatch(error);
|
||||
return this.getServerCode;
|
||||
});
|
||||
@@ -1115,7 +1120,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.setServerCode(tools.CALLING);
|
||||
|
||||
return Api.SendReq('/vreg', 'POST', usertosend)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
// console.log("RITORNO 2 ");
|
||||
// mutations.setServerCode(myres);
|
||||
if (res.data.code === serv_constants.RIS_CODE_EMAIL_VERIFIED) {
|
||||
@@ -1126,7 +1131,30 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return { code: res.data.code, msg: res.data.msg };
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
this.setErrorCatch(error);
|
||||
return { code: this.getServerCode, msg: error.getMsgError() };
|
||||
});
|
||||
},
|
||||
async reverif_email(paramquery: ILinkReg) {
|
||||
const usertosend = {
|
||||
idlink: paramquery.idlink,
|
||||
};
|
||||
console.log(usertosend);
|
||||
|
||||
this.setServerCode(tools.CALLING);
|
||||
|
||||
return Api.SendReq('/reverif_email', 'POST', usertosend)
|
||||
.then((res: any) => {
|
||||
if (res.data.code === serv_constants.RIS_CODE_EMAIL_VERIFIED) {
|
||||
console.log('VERIFICATO !!');
|
||||
tools.localStSetItem(toolsext.localStorage.verified_email, String(true));
|
||||
} else {
|
||||
console.log('Risultato di vreg: ', res.data.code);
|
||||
}
|
||||
return { code: res.data.code, msg: res.data.msg };
|
||||
})
|
||||
.catch((error: any) => {
|
||||
this.setErrorCatch(error);
|
||||
return { code: this.getServerCode, msg: error.getMsgError() };
|
||||
});
|
||||
@@ -1141,7 +1169,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.setServerCode(tools.CALLING);
|
||||
|
||||
return Api.SendReq('/ammetti', 'POST', usertosend)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
// console.log("RITORNO 2 ");
|
||||
// mutations.setServerCode(myres);
|
||||
if (res.data.code === serv_constants.RIS_CODE_AMMESSO) {
|
||||
@@ -1151,7 +1179,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return { code: res.data.code, msg: res.data.msg };
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
this.setErrorCatch(error);
|
||||
return { code: this.getServerCode, msg: error.getMsgError() };
|
||||
});
|
||||
@@ -1170,7 +1198,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.setServerCode(tools.CALLING);
|
||||
|
||||
return Api.SendReq('/abcirc', 'POST', usertosend)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
// console.log("RITORNO 2 ");
|
||||
// mutations.setServerCode(myres);
|
||||
if (res.data.code === serv_constants.RIS_CODE_AMMESSO) {
|
||||
@@ -1178,9 +1206,13 @@ export const useUserStore = defineStore('UserStore', {
|
||||
} else {
|
||||
console.log('Risultato di abilita: ', res.data.code);
|
||||
}
|
||||
return { code: res.data.code, msg: res.data.msg, circuitName: res.data.circuitName };
|
||||
return {
|
||||
code: res.data.code,
|
||||
msg: res.data.msg,
|
||||
circuitName: res.data.circuitName,
|
||||
};
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
this.setErrorCatch(error);
|
||||
return { code: this.getServerCode, msg: error.getMsgError() };
|
||||
});
|
||||
@@ -1188,7 +1220,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
async unsubscribe(paramquery: any) {
|
||||
return Api.SendReq('/news/unsubscribe', 'POST', paramquery)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
// console.log("RITORNO 2 ");
|
||||
// mutations.setServerCode(myres);
|
||||
if (res.data.code === serv_constants.RIS_UNSUBSCRIBED_OK) {
|
||||
@@ -1203,7 +1235,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
async unsubscribe_news_on_fielduser(paramquery: any) {
|
||||
return Api.SendReq('/news/unsubscribe_user', 'POST', paramquery)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res.data.code === serv_constants.RIS_UNSUBSCRIBED_OK) {
|
||||
console.log('DESOTTOSCRITTO ALLA NEWSLETTER !!');
|
||||
} else {
|
||||
@@ -1216,16 +1248,16 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
async importemail(paramquery: any) {
|
||||
return Api.SendReq('/news/import', 'POST', paramquery)
|
||||
.then((res) => res)
|
||||
.then((res: any) => res)
|
||||
.catch((error) => ({ numtot: 0, numadded: 0, numalreadyexisted: 0 }));
|
||||
},
|
||||
|
||||
async importExtraList(paramquery: any) {
|
||||
return Api.SendReq('/users/import_extralist', 'POST', paramquery)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return res;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return { numtot: 0, numadded: 0, numalreadyexisted: 0 };
|
||||
});
|
||||
},
|
||||
@@ -1244,22 +1276,22 @@ export const useUserStore = defineStore('UserStore', {
|
||||
null,
|
||||
{ timeout: 300000 }
|
||||
)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
async execDbOpUser(paramquery: any) {
|
||||
return Api.SendReq('/users/dbopuser', 'POST', paramquery)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
tools.updateMyData(res.data.ris);
|
||||
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return false;
|
||||
});
|
||||
},
|
||||
@@ -1327,6 +1359,31 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return await this.execDbOpUser({ mydata });
|
||||
},
|
||||
async setVerifiedEmail(val: boolean, userId?: string) {
|
||||
const mydata = {
|
||||
_id: userId ? userId : this.my._id,
|
||||
dbop: 'verifiedemail',
|
||||
value: val,
|
||||
};
|
||||
|
||||
if (userId) {
|
||||
} else {
|
||||
if (this.my.verified_email !== val) {
|
||||
this.my.verified_email = val;
|
||||
}
|
||||
}
|
||||
return await this.execDbOpUser({ mydata });
|
||||
},
|
||||
async resendVerificationEmail() {
|
||||
const mydata = {
|
||||
_id: this.my._id,
|
||||
dbop: 'resendVerificationEmail',
|
||||
value: this.my.email,
|
||||
};
|
||||
|
||||
return await this.execDbOpUser({ mydata });
|
||||
},
|
||||
|
||||
async setPwdComeQuellaDellAdmin(val: boolean, userId?: string) {
|
||||
const mydata = {
|
||||
_id: userId,
|
||||
@@ -1388,10 +1445,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
async getProvincesForMap() {
|
||||
return Api.SendReq('/users/infomap', 'POST', null)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return res ? res.data.ris : [];
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((e: any) => {
|
||||
console.error('Err getProvincesForMap:', e);
|
||||
return null;
|
||||
});
|
||||
},
|
||||
@@ -1417,29 +1475,29 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return null;
|
||||
});
|
||||
},
|
||||
|
||||
async reportload(paramquery: any) {
|
||||
return Api.SendReq('/report/load', 'POST', paramquery)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
// console.log('res', res)
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return null;
|
||||
});
|
||||
},
|
||||
|
||||
async newsletter_setactivate(paramquery: any) {
|
||||
return Api.SendReq('/news/setactivate', 'POST', paramquery)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
// console.log('res', res)
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return null;
|
||||
});
|
||||
},
|
||||
@@ -1599,7 +1657,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.setServerCode(tools.CALLING);
|
||||
|
||||
return Api.SendReq('/users', 'POST', authData)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
const newuser = res.data;
|
||||
|
||||
// console.log('newuser', newuser)
|
||||
@@ -1652,7 +1710,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return { code: toolsext.ERR_GENERICO, msg: '' };
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
console.log('Err', error);
|
||||
this.setErrorCatch(error);
|
||||
return { code: this.getServerCode, msg: this.getMsg };
|
||||
@@ -1723,14 +1781,14 @@ export const useUserStore = defineStore('UserStore', {
|
||||
authData.userId = this.my._id;
|
||||
|
||||
return Api.SendReq('/iscritti_conacreis', 'POST', authData)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res.status === 200) {
|
||||
return { code: serv_constants.RIS_ISCRIZIONE_OK, msg: '' };
|
||||
} else {
|
||||
return { code: toolsext.ERR_GENERICO, msg: '' };
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
console.log('Err', error);
|
||||
this.setErrorCatch(error);
|
||||
return { code: this.getServerCode, msg: this.getMsg };
|
||||
@@ -1771,7 +1829,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
// console.log('executing login...')
|
||||
|
||||
return await Api.SendReq('/users/login', 'POST', usertosend, true, false, 0)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
myres = res;
|
||||
|
||||
if (myres.status !== 200) {
|
||||
@@ -1779,7 +1837,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return myres;
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
console.log(' Login res', res);
|
||||
|
||||
if (res.success) {
|
||||
@@ -1808,7 +1866,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return code;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
console.log('error', error);
|
||||
this.setErrorCatch(error);
|
||||
return this.getServerCode;
|
||||
@@ -1848,11 +1906,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.clearAuthData();
|
||||
|
||||
return await Api.SendReq('/users/me/token', 'DELETE', null)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
console.log(res);
|
||||
})
|
||||
.then(() => this.clearAuthData())
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
this.setErrorCatch(error);
|
||||
return this.getServerCode;
|
||||
});
|
||||
@@ -1977,14 +2035,14 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return await Api.SendReq('/users/profile', 'POST', data)
|
||||
.then((ris) => {
|
||||
.then((ris: any) => {
|
||||
if (this.my.username === ris.data.user.username) {
|
||||
// this.updateDataFr(ris.data.friends)
|
||||
}
|
||||
|
||||
return ris.data.user;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2002,14 +2060,14 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return await Api.SendReq('/users/activities', 'POST', data)
|
||||
.then((ris) => {
|
||||
.then((ris: any) => {
|
||||
if (this.my.username === ris.data.user.username) {
|
||||
// this.updateDataFr(ris.data.friends)
|
||||
}
|
||||
|
||||
return ris.data.user;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2020,10 +2078,10 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/users/notifs', 'POST', data)
|
||||
.then((ris) => {
|
||||
.then((ris: any) => {
|
||||
return ris.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2034,11 +2092,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/users/panel', 'POST', data)
|
||||
.then((ris) => {
|
||||
.then((ris: any) => {
|
||||
console.log('out:', ris);
|
||||
return ris.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2050,11 +2108,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/users/receiveris', 'POST', data)
|
||||
.then((ris) => {
|
||||
.then((ris: any) => {
|
||||
console.log('out:', ris);
|
||||
return ris.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2065,11 +2123,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/users/listlinkreg', 'POST', data)
|
||||
.then((ris) => {
|
||||
.then((ris: any) => {
|
||||
console.log('out:', ris);
|
||||
return ris.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2081,10 +2139,10 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/mygroup/load', 'POST', data)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return { data: res.data, status: res.status };
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return { data: null, status: error.status };
|
||||
});
|
||||
},
|
||||
@@ -2098,7 +2156,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/circuit/load', 'POST', data)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
this.my.profile.last_circuitpath = path;
|
||||
if (res && res.data.arrrecnotif) {
|
||||
notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif);
|
||||
@@ -2111,7 +2169,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return { data: res.data, status: res.status };
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return { data: null, status: error.status };
|
||||
});
|
||||
},
|
||||
@@ -2122,11 +2180,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/myskills/page', 'POST', data)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
console.log('res.data', res);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2139,10 +2197,10 @@ export const useUserStore = defineStore('UserStore', {
|
||||
};
|
||||
|
||||
return Api.SendReq('/mygen/page', 'POST', data)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
console.error('err', error);
|
||||
return null;
|
||||
});
|
||||
@@ -2163,41 +2221,41 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
async loadFriends() {
|
||||
return Api.SendReq('/users/friends', 'POST', null)
|
||||
.then((ris) => {
|
||||
.then((ris: any) => {
|
||||
this.updateDataFr(ris.data);
|
||||
return ris.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
|
||||
async loadGroups(username: string) {
|
||||
return Api.SendReq('/users/groups', 'POST', null)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
|
||||
async loadCircuits(nummovTodownload: number) {
|
||||
return Api.SendReq('/users/circuits', 'POST', { nummovTodownload })
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
|
||||
async loadAllAccounts() {
|
||||
return Api.SendReq('/account/loadall', 'POST', null)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
return {};
|
||||
});
|
||||
},
|
||||
@@ -2216,11 +2274,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
cmd,
|
||||
value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
this.updateTables = true;
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
});
|
||||
@@ -2240,11 +2298,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
cmd,
|
||||
value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
this.updateTables = true;
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
});
|
||||
@@ -2264,14 +2322,14 @@ export const useUserStore = defineStore('UserStore', {
|
||||
cmd,
|
||||
value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
this.updateTables = true;
|
||||
// const notifStore = useNotifStore()
|
||||
|
||||
// notifStore.updateNotification = true
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
});
|
||||
@@ -2294,7 +2352,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
false,
|
||||
0
|
||||
)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
this.updateTables = true;
|
||||
const notifStore = useNotifStore();
|
||||
if (res.data.recnotif) {
|
||||
@@ -2308,7 +2366,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
});
|
||||
@@ -2323,7 +2381,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
return Api.SendReq('/users/mgt', 'POST', { mydata })
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
console.log('res', res);
|
||||
|
||||
let msgok =
|
||||
@@ -2354,7 +2412,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
tools.showNegativeNotif($q, t('cal.err_sendmsg'));
|
||||
return {};
|
||||
});
|
||||
@@ -2399,7 +2457,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
$q.loading.hide();
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
$q.loading.hide();
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
@@ -2421,7 +2479,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
tab,
|
||||
value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (myrec) {
|
||||
if (!myrec.numfav) {
|
||||
@@ -2451,7 +2509,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
tools.showNegativeNotif($q, t('cmd.favorite_unset'));
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
});
|
||||
@@ -2472,7 +2530,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
tab,
|
||||
value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (!myrec.numattend) {
|
||||
myrec.numattend = 0;
|
||||
@@ -2498,7 +2556,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
tools.showNegativeNotif($q, t('cmd.attend_unset'));
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
});
|
||||
@@ -2546,7 +2604,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
tab,
|
||||
value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (!myrec.numbook) {
|
||||
myrec.numbook = 0;
|
||||
@@ -2572,7 +2630,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
tools.showNegativeNotif($q, t('cmd.bookmark_unset'));
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
console.error('error', error);
|
||||
tools.showNegativeNotif($q, t('db.recfailed'));
|
||||
return {};
|
||||
@@ -2624,7 +2682,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
tab,
|
||||
value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (value) {
|
||||
if (!myrec) {
|
||||
@@ -2651,7 +2709,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
console.error('error', error);
|
||||
return null;
|
||||
});
|
||||
@@ -2671,7 +2729,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
},
|
||||
|
||||
async eseguiFunzSulServer(mydata: {}) {
|
||||
return await this.execDbOp({ mydata }).then((ris) => {
|
||||
return await this.execDbOp({ mydata }).then((ris: any) => {
|
||||
return ris?.data;
|
||||
});
|
||||
},
|
||||
@@ -2739,5 +2797,25 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getLastRecentUserTransactions() {
|
||||
const arr = [];
|
||||
for (const rec of this.my.profile.last_my_transactions) {
|
||||
let myuser = null;
|
||||
|
||||
if (rec.userfrom && rec.userfrom.username !== this.my.username) {
|
||||
myuser = rec.userfrom;
|
||||
} else if (rec.userto && rec.userto.username !== this.my.username) {
|
||||
myuser = rec.userto;
|
||||
}
|
||||
|
||||
if (myuser) {
|
||||
arr.push(myuser);
|
||||
}
|
||||
}
|
||||
|
||||
const uniques = arr.filter((v, i, a) => a.findIndex(t => (t.username === v.username)) === i);
|
||||
return uniques;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user