Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: routing #2106

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions desk/src/components/SidebarLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[bgColor]: isActive,
[hvColor]: !isActive,
}"
@click="handle"
@click="handleNavigation"
>
<span
class="shrink-0 text-gray-700"
Expand Down Expand Up @@ -50,19 +50,18 @@ interface P {

const props = withDefaults(defineProps<P>(), {
isActive: false,
onClick: () => () => true,
onClick: () => {},
to: "",
bgColor: "bg-white",
hvColor: "hover:bg-gray-100",
});
const router = useRouter();

function handle() {
function handleNavigation() {
props.onClick();
if (props.to) {
router.push({
name: props.to,
});
}
if (router.currentRoute.value.name === props.to) return;
router.push({
name: props.to,
});
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function handleSubCategoryClick(subCategory: SubCategory) {
},
});
categoryTreeResource.reload();
router.push({
router.replace({
query: {
category: categoryTreeResource.data.root_category.category_id,
subCategory: subCategory.name,
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/layouts/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import { storeToRefs } from "pinia";
import { useAuthStore } from "@/stores/auth";
import { useNotificationStore } from "@/stores/notification";
import { useSidebarStore } from "@/stores/sidebar";
import { CUSTOMER_PORTAL_LANDING, CUSTOMER_PORTAL_ROUTES } from "@/router";
import { CUSTOMER_PORTAL_LANDING } from "@/router";
import { useDevice } from "@/composables";
import { SidebarLink } from "@/components";
import UserMenu from "@/components/UserMenu.vue";
Expand Down
5 changes: 5 additions & 0 deletions desk/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@
shadow-2xl
}
}

/* input tye text */
input[type="text"] {
border: none;
}
2 changes: 1 addition & 1 deletion desk/src/pages/ticket/TicketConversation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class="w-full activity grid grid-cols-[30px_minmax(auto,_1fr)] gap-2 sm:gap-4"
>
<div
class="relative flex justify-center after:absolute after:left-[50%] after:top-[12%] after:-z-10 after:border-l after:border-gray-200 after:h-full"
class="relative flex justify-center after:absolute after:left-[50%] after:top-[8%] after:-z-10 after:border-l after:border-gray-200 after:h-full"
>
<Avatar
size="lg"
Expand Down
11 changes: 8 additions & 3 deletions desk/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,8 @@ export const router = createRouter({

router.beforeEach(async (to, _, next) => {
const authStore = useAuthStore();
const userStore = useUserStore();

if (authStore.isLoggedIn) {
await authStore.init();
await userStore.users.fetch();
}

if (!authStore.isLoggedIn) {
Expand All @@ -246,3 +243,11 @@ router.beforeEach(async (to, _, next) => {
next();
}
});

router.afterEach(async (to) => {
const userStore = useUserStore();
const isCustomerPortal = to.meta.public ?? false;
if (!isCustomerPortal) {
await userStore.users.fetch();
}
});
Loading