Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Oct 16, 2023
1 parent 5d272e6 commit 4f1b4dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions resources/js/Pages/Monica/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ const props = defineProps({
links: Object,
});
const refresh = ref(_.debounce(() => doRefresh(), 1000));
const doRefresh = ref(_.debounce(() => onRefresh(), 1000));
const updateForm = useForm({
plan_id: null,
});
const subscribeForm = useForm({});
onMounted(() => {
if (props.refresh) {
(refresh.value)();
(doRefresh.value)();
}
});
onUnmounted(() => {
refresh.value.cancel();
doRefresh.value.cancel();
});
const currentPlan = computed(() => props.current_licence === null ? null : plan(props.current_licence.plan_id));
Expand All @@ -38,13 +38,13 @@ const licenceCancelled = computed(() => props.current_licence.subscription_state
const plan = (id) => props.plans[props.plans.findIndex((x) => x.id === id)];
const doRefresh = () => {
const onRefresh = () => {
if (usePage().component.value === 'Monica/Index') {
router.reload({
only: ['current_licence'],
onFinish: () => {
if (props.current_licence === null || props.current_licence.subscription_state === 'subscription_cancelled') {
(refresh.value)();
(doRefresh.value)();
}
},
});
Expand Down
10 changes: 5 additions & 5 deletions resources/js/Pages/OfficeLife/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const props = defineProps({
});
const localPlans = ref([]);
const refresh = ref(_.debounce(() => doRefresh(), 1000));
const doRefresh = ref(_.debounce(() => onRefresh(), 1000));
const updateForm = useForm({
plan_id: null,
});
Expand All @@ -28,12 +28,12 @@ const subscribeForm = useForm({
onMounted(() => {
localPlans.value = props.plans;
if (props.refresh) {
(refresh.value)();
(doRefresh.value)();
}
});
onUnmounted(() => {
refresh.value.cancel();
doRefresh.value.cancel();
});
const currentPlan = computed(() => props.current_licence === null || props.current_licence.subscription_state === 'subscription_cancelled' ? null : plan(props.current_licence.plan_id));
Expand All @@ -42,13 +42,13 @@ const licenceCancelled = computed(() => props.current_licence.subscription_state
const plan = (id) => localPlans.value[localPlans.value.findIndex((x) => x.id === id)];
const doRefresh = () => {
const onRefresh = () => {
if (usePage().component.value === 'OfficeLife/Index') {
router.reload({
only: ['current_licence'],
onFinish: () => {
if (props.current_licence === null || props.current_licence.subscription_state === 'subscription_cancelled') {
(refresh.value)();
(doRefresh.value)();
}
},
});
Expand Down

0 comments on commit 4f1b4dd

Please sign in to comment.