Skip to content

Commit

Permalink
feat(admin): save order filter state
Browse files Browse the repository at this point in the history
  • Loading branch information
mavyfaby committed Sep 21, 2023
1 parent 68d0a82 commit ca78080
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/pages/admin/tabs/TabOrders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { FullOrderEnum } from "~/types/models";
import { OrderStatus } from "~/types/enums";
import { getMonthYear } from "~/utils/date";
import { capitalize } from "~/utils/string";
import { getStore, setStore } from "~/utils/storage";
import { useStore } from "~/store";
import { Env } from "~/config";
Expand All @@ -78,7 +79,7 @@ const data = ref({
orders: [] as FullOrderModel[],
page: 1,
search: "",
filterStatus: [OrderStatus.PENDING_PAYMENT],
filterStatus: getStore("tabs_orders_status") ? JSON.parse(getStore("tabs_orders_status")) : [OrderStatus.PENDING_PAYMENT],
column: FullOrderEnum.reference,
});
Expand Down Expand Up @@ -113,6 +114,7 @@ watch([
() => data.value.filterStatus,
() => data.value.page,
], v => {
setStore("tabs_orders_status", JSON.stringify(data.value.filterStatus));
fetchOrders(v[0]);
});
Expand Down
3 changes: 2 additions & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ declare global {
link?: string
}

type StoreKeys = "dark" | "std_token" | "adm_token" | "home_msg_role" | "login_id" | "student";
type StoreKeys = "dark" | "std_token" | "adm_token" | "home_msg_role" |
"login_id" | "student" | "tabs_orders_status";
}

export {};

1 comment on commit ca78080

@vercel
Copy link

@vercel vercel bot commented on ca78080 Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

csps – ./

csps-git-main-csps.vercel.app
csps-csps.vercel.app
ucmncsps.org

Please sign in to comment.