fix: request loading indicator
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent } from "@nuxtjs/composition-api"
|
||||
import { useReadonlyStream } from "~/helpers/utils/composables"
|
||||
import { computed, defineComponent, watch } from "@nuxtjs/composition-api"
|
||||
import { useNuxt, useReadonlyStream } from "~/helpers/utils/composables"
|
||||
import { restResponse$ } from "~/newstore/RESTSession"
|
||||
|
||||
export default defineComponent({
|
||||
@@ -26,6 +26,13 @@ export default defineComponent({
|
||||
() => response.value === null || response.value.type === "loading"
|
||||
)
|
||||
|
||||
const nuxt = useNuxt()
|
||||
|
||||
watch(response, () => {
|
||||
if (response.value?.type === "loading") nuxt.value.$loading.start()
|
||||
else nuxt.value.$loading.finish()
|
||||
})
|
||||
|
||||
return {
|
||||
hasResponse,
|
||||
response,
|
||||
|
||||
Reference in New Issue
Block a user