various improvements
This commit is contained in:
30
pages/channel/@me/index.vue
Normal file → Executable file
30
pages/channel/@me/index.vue
Normal file → Executable file
@@ -1,35 +1,35 @@
|
||||
<template>
|
||||
<form @submit.prevent="startDM">
|
||||
<input v-model="userId" />
|
||||
<input type="submit" />
|
||||
</form>
|
||||
<form @submit.prevent="startDM">
|
||||
<input v-model="userId">
|
||||
<input type="submit">
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { useGlobalStore } from '~/stores/store'
|
||||
import { IChannel } from '~/types'
|
||||
import { useGlobalStore } from '~/stores/store';
|
||||
import { IChannel } from '~/types';
|
||||
|
||||
definePageMeta({
|
||||
middleware: 'auth'
|
||||
})
|
||||
middleware: 'auth'
|
||||
});
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userId: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
useGlobalStore().setActiveServer('dms', '@me')
|
||||
useGlobalStore().setActiveServer('dms', '@me');
|
||||
},
|
||||
methods: {
|
||||
async startDM() {
|
||||
const headers = useRequestHeaders(['cookie']) as Record<string, string>
|
||||
const server: IChannel = await $fetch('/api/channels/createDM', { method: 'post', body: { partnerId: this.userId }, headers })
|
||||
const headers = useRequestHeaders(['cookie']) as Record<string, string>;
|
||||
const server: IChannel = await $fetch('/api/channels/createDM', { method: 'post', body: { partnerId: this.userId }, headers });
|
||||
|
||||
useGlobalStore().addDM(server)
|
||||
useRouter().push({ path: '/channel/@me/' + server.id })
|
||||
useGlobalStore().addDM(server);
|
||||
useRouter().push({ path: '/channel/@me/' + server.id });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user