Skip to content

Commit cf20142

Browse files
committed
fix(sla-badge): emit SLA status on change so callers can react
1 parent 8654a04 commit cf20142

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

frontend/src/features/sla/SlaBadge.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</template>
3333

3434
<script setup>
35-
import { ref } from 'vue'
35+
import { ref, watch } from 'vue'
3636
import { useSla } from '@/composables/useSla'
3737
import { AlertCircle, CheckCircle, Clock } from 'lucide-vue-next'
3838
const props = defineProps({
@@ -45,10 +45,21 @@ const props = defineProps({
4545
}
4646
})
4747
48+
const emit = defineEmits(['status'])
49+
4850
let sla = null
4951
if (props.dueAt) {
5052
sla = useSla(ref(props.dueAt), ref(props.actualAt))
5153
}
54+
55+
// Watch for status change and emit
56+
watch(
57+
sla,
58+
(newVal) => {
59+
if (newVal?.status) emit('status', newVal.status)
60+
},
61+
{ immediate: true }
62+
)
5263
</script>
5364
5465
<style scoped>

0 commit comments

Comments
 (0)