ticketOverviewStorage.ts 614 B

1234567891011121314151617181920212223
  1. // Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. import useSession from '@shared/stores/session'
  3. export const getTicketOverviewStorage = () => {
  4. const session = useSession()
  5. const LOCAL_STORAGE_NAME = `ticket-overviews-${session.user?.id || '1'}`
  6. const getOverviews = (): string[] => {
  7. return JSON.parse(localStorage.getItem(LOCAL_STORAGE_NAME) || '[]')
  8. }
  9. const saveOverviews = (overviews: string[]) => {
  10. return localStorage.setItem(LOCAL_STORAGE_NAME, JSON.stringify(overviews))
  11. }
  12. return {
  13. getOverviews,
  14. saveOverviews,
  15. LOCAL_STORAGE_NAME,
  16. }
  17. }