Search with enter. Also fix bug where searching when inside a creator page dont call the backend to search the new user
This commit is contained in:
@@ -52,7 +52,7 @@ import PostCard from "@/views/main/PostCard.vue"
|
||||
import posts from "@/views/main/posts.json"
|
||||
import PostMessage from "@/views/messages/PostMessage.vue";
|
||||
import MessageList from "@/views/messages/MessageList.vue";
|
||||
import {onBeforeMount, ref} from "vue";
|
||||
import {onBeforeMount, ref, watch} from "vue";
|
||||
import {useClient} from "@/plugins/api.js";
|
||||
import {useRoute} from "vue-router";
|
||||
import CreatorBanner from "@/views/main/CreatorBanner.vue";
|
||||
@@ -67,13 +67,25 @@ const user = ref(null);
|
||||
const loading = ref(true);
|
||||
|
||||
onBeforeMount(async() => {
|
||||
const response = await client.get(`/api/Users?UserName=${route.params.creator}`)
|
||||
user.value = response.data
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 1500);
|
||||
const response = await client.get(`/api/Users?UserName=${route.params.creator}`)
|
||||
user.value = response.data
|
||||
})
|
||||
|
||||
watch(
|
||||
() => route.params.creator,
|
||||
async () => {
|
||||
loading.value = true;
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 1000);
|
||||
const response = await client.get(`/api/Users?UserName=${route.params.creator}`)
|
||||
user.value = response.data
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
class="rounded-full w-32 md:w-64 lg:w-96 mx-2"
|
||||
append-inner-icon="mdi-magnify"
|
||||
@click.stop
|
||||
@click:append-inner="onSearch">
|
||||
@click:append-inner="onSearch"
|
||||
@keyup.enter="onSearch"
|
||||
>
|
||||
</v-text-field>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
||||
Reference in New Issue
Block a user