2022-08-30 10:34:09 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
Single
|
|
|
|
<div>
|
|
|
|
{{ data }} - {{ data2 }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
const { data, refresh } = await useCounter()
|
|
|
|
const { data: data2, refresh: refresh2 } = await useCounter()
|
|
|
|
|
2022-11-03 20:22:20 +00:00
|
|
|
let initial = data.value!.count
|
2022-08-30 10:34:09 +00:00
|
|
|
|
|
|
|
// Refresh on client and server side
|
|
|
|
await refresh()
|
|
|
|
|
2022-11-03 20:22:20 +00:00
|
|
|
if (data.value!.count !== initial + 1) {
|
|
|
|
throw new Error('Data not refreshed?' + data.value!.count + ' : ' + data2.value!.count)
|
2022-08-30 10:34:09 +00:00
|
|
|
}
|
|
|
|
|
2022-11-03 20:22:20 +00:00
|
|
|
if (data.value!.count !== data2.value!.count) {
|
2022-08-30 10:34:09 +00:00
|
|
|
throw new Error('AsyncData not synchronised')
|
|
|
|
}
|
|
|
|
|
2022-11-03 20:22:20 +00:00
|
|
|
initial = data.value!.count
|
2022-08-30 10:34:09 +00:00
|
|
|
|
|
|
|
await refresh2()
|
|
|
|
|
2022-11-03 20:22:20 +00:00
|
|
|
if (data.value!.count !== initial + 1) {
|
2023-10-25 00:36:04 +00:00
|
|
|
throw new Error('data2 refresh not synchronised?')
|
2022-08-30 10:34:09 +00:00
|
|
|
}
|
|
|
|
|
2022-11-03 20:22:20 +00:00
|
|
|
if (data.value!.count !== data2.value!.count) {
|
2022-08-30 10:34:09 +00:00
|
|
|
throw new Error('AsyncData not synchronised')
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|