-
Notifications
You must be signed in to change notification settings - Fork 1
/
GroupSettings.vue
126 lines (116 loc) · 3.41 KB
/
GroupSettings.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<script setup lang="ts">
import axios from "axios";
import {
UserMinusIcon,
UserPlusIcon,
} from '@heroicons/vue/24/outline'
import router from "@/router";
import {ref} from "vue";
const userName = ref<string>();
let userId = ref<number>();
const groupId = () => {
return router.currentRoute.value.params.id;
}
const inviteUser = async () => {
await axios.get(`${import.meta.env.VITE_BACKEND_HOST}/user`,
{
headers: {
'Content-Type':
'application/json'
},
withCredentials: true
}
).then(res => res.data.map((user:any) => {
if (user.username === userName.value) {
console.log('setting');
userId.value = user.userId;
}
}))
try {
console.log('submitting: ', userName.value, userId.value)
const result = await axios.patch(
`${import.meta.env.VITE_BACKEND_HOST}/circle/group/${userId.value}`,
{userIds: [userName.value, userId.value]},
{
headers: {
'Content-Type': 'application/json'
},
withCredentials: true
}
)
console.log(result)
return result.data
} catch (error) {
}
}
const users = [
{
username: "Meredit Sommer",
profileImage: "../../public/images/profileImages/ente.png"
},
{
username: "Samuel Lupica",
profileImage: "../../public/images/profileImages/faultier.png"
},
{
username: "Nadia Kramer",
profileImage: "../../public/images/profileImages/waschbär.png"
}
];
</script>
<template>
<div class="inlay flex flex-col items-center">
<div class="drop-shadow-lg mb-12 flex flex-col w-full">
<div class="font-yeseva text-6 text-center rounded-t-2xl bg-scared-light py-2">
Members
</div>
<div class="p-4 bg-white drop-shadow-lg rounded-b-2xl">
<div class="flex flex-col gap-4">
<div v-for="user in users" class="flex gap-6 items-center justify-between">
<img :src="user.profileImage" class="w-12 h-12 rounded-full">
{{ user.username }}
<user-minus-icon class="w-8"></user-minus-icon>
</div>
</div>
</div>
</div>
<v-dialog
class="!w-96 !font-poppins"
transition="dialog-bottom-transition"
width="auto"
>
<template v-slot:activator="{ props }">
<v-btn
v-bind="props"
class="!text-center !w-fit !bg-rejecting !px-8 !py-4 !rounded-full font-poppins shadow-none !flex !gap-2 !align-center"
> Invite User
<user-plus-icon class="w-4"></user-plus-icon>
</v-btn>
</template>
<template v-slot:default="{ isActive }">
<v-card>
<v-toolbar
class="!bg-rejecting"
title="Invite new User"
></v-toolbar>
<v-text-field class="w-96"
placeholder="Username"
v-model="userName"
>
</v-text-field>
<v-card-actions class="justify-between">
<v-btn
variant="text"
@click="isActive.value = false"
>Close
</v-btn>
<Button @click="inviteUser()" type="submit" variant="outline"
class="w-fit px-8 py-2 drop-shadow-md rounded-full text-4 bg-white border-none font-poppins">
Submit
</Button>
</v-card-actions>
</v-card>
</template>
</v-dialog>
</div>
</template>