fix(sla-badge): emit SLA status on change so callers can react

This commit is contained in:
Abhinav Raut
2025-05-24 23:01:52 +05:30
parent 8654a04dcf
commit cf20142e40

View File

@@ -32,7 +32,7 @@
</template>
<script setup>
import { ref } from 'vue'
import { ref, watch } from 'vue'
import { useSla } from '@/composables/useSla'
import { AlertCircle, CheckCircle, Clock } from 'lucide-vue-next'
const props = defineProps({
@@ -45,10 +45,21 @@ const props = defineProps({
}
})
const emit = defineEmits(['status'])
let sla = null
if (props.dueAt) {
sla = useSla(ref(props.dueAt), ref(props.actualAt))
}
// Watch for status change and emit
watch(
sla,
(newVal) => {
if (newVal?.status) emit('status', newVal.status)
},
{ immediate: true }
)
</script>
<style scoped>