stream day 6
This commit is contained in:
@@ -2,6 +2,16 @@
|
||||
<MessagePane :server="server" />
|
||||
</template>
|
||||
|
||||
<script async setup lang="ts">
|
||||
const route = useRoute()
|
||||
|
||||
const server: IChannel = await $fetch(`/api/channels/${route.params.id}`)
|
||||
if (server) {
|
||||
useGlobalStore().addDM(server);
|
||||
useGlobalStore().setActive('dms', server.id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { useGlobalStore } from '~/stores/store'
|
||||
import { IChannel } from '~/types'
|
||||
@@ -11,18 +21,6 @@ definePageMeta({
|
||||
})
|
||||
|
||||
export default {
|
||||
async setup() {
|
||||
const route = useRoute()
|
||||
|
||||
const server: IChannel = await $fetch(`/api/channels/${route.params.id}`)
|
||||
if (!server) return;
|
||||
useGlobalStore().addDM(server);
|
||||
useGlobalStore().setActive('dms', server.id);
|
||||
|
||||
return {
|
||||
server,
|
||||
}
|
||||
},
|
||||
async updated() {
|
||||
if (!useGlobalStore().activeServer == this.server) useGlobalStore().setActive('dms', this.server.id)
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ const route = useRoute()
|
||||
|
||||
const server: IChannel = await $fetch(`/api/channels/${route.params.id}`)
|
||||
|
||||
const realServer = useGlobalStore().user.servers.filter((e) => e.channels.some((el) => el.id == route.params.id))[0]
|
||||
const realServer = useGlobalStore().user.servers?.filter((e) => e.channels.some((el) => el.id == route.params.id))[0]
|
||||
|
||||
if (realServer) {
|
||||
useGlobalStore().addServer(realServer);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { useGlobalStore } from '~/stores/store'
|
||||
import { IUser } from '~/types';
|
||||
import { SafeUser } from '~/types';
|
||||
|
||||
definePageMeta({
|
||||
layout: 'clean'
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
username: this.username,
|
||||
password: this.password
|
||||
}
|
||||
}) as { userId: string; token: string; user: IUser; }
|
||||
}) as { userId: string; token: string; user: SafeUser; }
|
||||
|
||||
const userId = useCookie('userId')
|
||||
userId.value = user.userId
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<script lang="ts">
|
||||
import { NuxtLink } from '~/.nuxt/components';
|
||||
import { useGlobalStore } from '~/stores/store'
|
||||
import { IUser } from '~/types';
|
||||
import { SafeUser } from '~/types';
|
||||
|
||||
definePageMeta({
|
||||
layout: 'clean'
|
||||
@@ -55,7 +55,7 @@ export default {
|
||||
email: this.email,
|
||||
password: this.password
|
||||
}
|
||||
}) as { userId: string; token: string; user: IUser; }
|
||||
}) as { userId: string; token: string; user: SafeUser; }
|
||||
|
||||
const userId = useCookie('userId')
|
||||
userId.value = user.userId
|
||||
|
||||
Reference in New Issue
Block a user