attempt to fix lol

This commit is contained in:
ThatOneCalculator 2022-09-13 17:32:43 -07:00
parent bb15e6ccbc
commit 26e475eb0c
2 changed files with 29 additions and 23 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "12.119.0-calc-rc.8", "version": "12.119.0-calc-rc.9",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -4,10 +4,10 @@
<div class="mk-group-page"> <div class="mk-group-page">
<div class="_section"> <div class="_section">
<div class="_content" style="display: flex; gap: var(--margin); flex-wrap: wrap;"> <div class="_content" style="display: flex; gap: var(--margin); flex-wrap: wrap;">
<MkButton inline @click="invite()">{{ $ts.invite }}</MkButton> <MkButton inline @click="invite()">{{ i18n.ts.invite }}</MkButton>
<MkButton inline @click="renameGroup()">{{ $ts.rename }}</MkButton> <MkButton inline @click="renameGroup()">{{ i18n.ts.rename }}</MkButton>
<MkButton inline @click="transfer()">{{ $ts.transfer }}</MkButton> <MkButton inline @click="transfer()">{{ i18n.ts.transfer }}</MkButton>
<MkButton inline @click="deleteGroup()">{{ $ts.delete }}</MkButton> <MkButton inline @click="deleteGroup()">{{ i18n.ts.delete }}</MkButton>
</div> </div>
</div> </div>
<div class="_section members _gap"> <div class="_section members _gap">
@ -35,28 +35,34 @@ import { computed, watch } from 'vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { useRouter } from '@/router';
import * as os from '@/os'; import * as os from '@/os';
const props = defineProps<{ const props = defineProps<{
groupId: { groupId: {
type: string, type: string,
required: true, required: true,
}, }
}>(); }>();
let users = [];
let group = null;
const router = useRouter();
watch(() => props.groupId, () => { watch(() => props.groupId, () => {
fetch(); fetch();
}); });
function fetch() { function fetch() {
os.api('users/groups/show', { os.api('users/groups/show', {
groupId: this.groupId groupId: props.groupId,
}).then(group => { }).then(gp => {
this.group = group; group = gp;
os.api('users/show', { os.api('users/show', {
userIds: this.group.userIds userIds: group.userIds
}).then(users => { }).then(us => {
this.users = users; users = us;
}); });
}); });
} }
@ -64,7 +70,7 @@ function fetch() {
function invite() { function invite() {
os.selectUser().then(user => { os.selectUser().then(user => {
os.apiWithDialog('users/groups/invite', { os.apiWithDialog('users/groups/invite', {
groupId: this.group.id, groupId: group.id,
userId: user.id userId: user.id
}); });
}); });
@ -72,32 +78,32 @@ function invite() {
function removeUser(user) { function removeUser(user) {
os.api('users/groups/pull', { os.api('users/groups/pull', {
groupId: this.group.id, groupId: group.id,
userId: user.id userId: user.id
}).then(() => { }).then(() => {
this.users = this.users.filter(x => x.id !== user.id); users = users.filter(x => x.id !== user.id);
}); });
} }
async function renameGroup() { async function renameGroup() {
const { canceled, result: name } = await os.inputText({ const { canceled, result: name } = await os.inputText({
title: this.$ts.groupName, title: i18n.ts.groupName,
default: this.group.name default: group.name
}); });
if (canceled) return; if (canceled) return;
await os.api('users/groups/update', { await os.api('users/groups/update', {
groupId: this.group.id, groupId: group.id,
name: name name: name
}); });
this.group.name = name; group.name = name;
} }
function transfer() { function transfer() {
os.selectUser().then(user => { os.selectUser().then(user => {
os.apiWithDialog('users/groups/transfer', { os.apiWithDialog('users/groups/transfer', {
groupId: this.group.id, groupId: group.id,
userId: user.id userId: user.id
}); });
}); });
@ -106,14 +112,14 @@ function transfer() {
async function deleteGroup() { async function deleteGroup() {
const { canceled } = await os.confirm({ const { canceled } = await os.confirm({
type: 'warning', type: 'warning',
text: this.$t('removeAreYouSure', { x: this.group.name }), text: i18n.ts('removeAreYouSure', { x: group.name }),
}); });
if (canceled) return; if (canceled) return;
await os.apiWithDialog('users/groups/delete', { await os.apiWithDialog('users/groups/delete', {
groupId: this.group.id groupId: group.id,
}); });
this.$router.push('/my/groups'); router.push('/my/groups');
} }
definePageMetadata(computed(() => ({ definePageMetadata(computed(() => ({