I have the following chunk of code that's duplicated across multiple components:
const mint = ref<string>('');
watch(() => payload.mintPk, async (newVal) => {
if (newVal.length >= 32) {
mint.value = await prettifyMint(payload.mintPk);
}
});
prettifyMint(payload.mintPk)
.then((m) => {
mint.value = m;
});
I can't figure out how to factor it out into a standalone function that can be re-used across components. Any advice?