This commit is contained in:
parent
20293bd028
commit
cc3bc45a2c
|
@ -0,0 +1,19 @@
|
|||
import { watch } from 'vue';
|
||||
|
||||
import { useUserStore } from 'stores/user';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
export const onUserId = (cb) => watch(
|
||||
() => userStore?.user?.id,
|
||||
async userId => {
|
||||
if (userId) {
|
||||
try {
|
||||
await cb(userId);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
Loading…
Reference in New Issue