Skip to content

Commit

Permalink
perf: use useQuery for timeCanSubmit
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <zhangtianli2006@163.com>
  • Loading branch information
ZTL-UwU committed Oct 1, 2024
1 parent 07f64ef commit 5a7ef74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 2 additions & 4 deletions components/TimeAvailability.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ const stateColor = {
},
};
onMounted(async () => {
if (!props.isCard)
state.value = await $api.time.currently.query() ? 'can' : 'cannot';
});
if (!props.isCard)
state.value = await $api.time.currently.query() ? 'can' : 'cannot';
</script>

<template>
Expand Down
8 changes: 1 addition & 7 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ const [isSubmitOpen, toggleSubmit] = useToggle(false);
const { data: rawSongList } = await $api.song.listSafe.useQuery();
const songList = ref(rawSongList.value ?? []);
const { data: arrangementList } = await $api.arrangement.listSafe.useQuery();
const timeCanSubmit = ref(true);
try {
timeCanSubmit.value = await $api.time.currently.query();
} catch (err) {
useErrorHandler(err);
}
const { data: timeCanSubmit } = await $api.time.currently.useQuery();
const isDesktop = ref(false);
onMounted(() => {
Expand Down

0 comments on commit 5a7ef74

Please sign in to comment.