Friendship Accepted and Refused (notification updated)

This commit is contained in:
Paolo Arena
2022-07-27 20:55:47 +02:00
parent 43619ec719
commit 7f23fe6d05
10 changed files with 87 additions and 16 deletions

View File

@@ -40,6 +40,7 @@ import { useCalendarStore } from '@store/CalendarStore'
import { Router } from 'vue-router'
import { AxiosResponse, default as Axios } from 'axios'
import { PayloadMessageTypes } from '@/common'
import { useNotifStore } from '@store/NotifStore'
export interface INotify {
color?: string | 'primary'
@@ -4614,6 +4615,7 @@ export const tools = {
addToMyFriends($q: any, username: string, usernameDest: string) {
const userStore = useUserStore()
const notifStore = useNotifStore()
$q.dialog({
message: t('db.domanda_addtofriend', { username: usernameDest }),
ok: { label: t('dialog.yes'), push: true },
@@ -4624,6 +4626,7 @@ export const tools = {
userStore.setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.SETFRIEND, null)
.then((res: any) => {
if (res) {
notifStore.updateNotification = true
userStore.my.profile.friends = [...userStore.my.profile.friends, res]
userStore.my.profile.req_friends = userStore.my.profile.req_friends.filter((rec: IFriends) => rec.username !== usernameDest)
tools.showPositiveNotif($q, t('db.addedfriend'))
@@ -4671,6 +4674,7 @@ export const tools = {
refuseReqFriends($q: any, username: string, usernameDest: string) {
const userStore = useUserStore()
const notifStore = useNotifStore()
$q.dialog({
message: t('db.domanda_revoke_friend', { username: usernameDest }),
ok: { label: t('dialog.yes'), push: true },
@@ -4680,6 +4684,7 @@ export const tools = {
userStore.setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, null).then((res) => {
if (res) {
notifStore.updateNotification = true
userStore.my.profile.req_friends = userStore.my.profile.req_friends.filter((user: IFriends) => user.username !== usernameDest)
tools.showPositiveNotif($q, t('db.removedfriend'))
}