{"version":3,"file":"tenants.queries-aTe7zEiF.js","sources":["../../src/api/tenants.api.ts","../../src/queries/tenants.queries.ts"],"sourcesContent":["import axios from 'axios';\r\nimport type { ITenant, ITenantType } from '@app/types';\r\n\r\nexport const getTenants = () => {\r\n return axios.get('/tenant');\r\n};\r\n\r\nexport const setCurrentTenant = (tenantId: string) => {\r\n return axios.post(`/tenant/set-current/${tenantId}`);\r\n};\r\n\r\nexport const setTenantOwner = (userId: string, isOwner: boolean) => {\r\n return axios.put(`/tenant-user/set-owner/${userId}/${isOwner ? 'true' : 'false'}`);\r\n};\r\n\r\nexport const getTenantTypes = () => {\r\n return axios.get('/tenant/tenant-types');\r\n};\r\n","import { getTenantTypes, getTenants } from '@app/api/tenants.api';\r\nimport { queryOptions } from '@tanstack/react-query';\r\n\r\nexport function getTenantsQuery() {\r\n return queryOptions({\r\n queryKey: ['tenant-list'],\r\n queryFn: async () => {\r\n const tenants = (await getTenants()).data;\r\n tenants.sort((a, b) => a.name.localeCompare(b.name));\r\n return tenants;\r\n },\r\n staleTime: 1000 * 60 * 5,\r\n });\r\n}\r\n\r\nexport const tenantTypesQueryKey = ['tenant-types'];\r\n\r\nexport function getTenantTypesQuery() {\r\n return queryOptions({\r\n queryKey: tenantTypesQueryKey,\r\n queryFn: async () => (await getTenantTypes()).data,\r\n });\r\n}\r\n"],"names":["getTenants","axios","setCurrentTenant","tenantId","setTenantOwner","userId","isOwner","getTenantTypes","getTenantsQuery","queryOptions","tenants","a","b","tenantTypesQueryKey","getTenantTypesQuery"],"mappings":"+CAGO,MAAMA,EAAa,IACjBC,EAAM,IAAe,SAAS,EAG1BC,EAAoBC,GACxBF,EAAM,KAAK,uBAAuBE,CAAQ,EAAE,EAGxCC,EAAiB,CAACC,EAAgBC,IACtCL,EAAM,IAAI,0BAA0BI,CAAM,IAAIC,EAAU,OAAS,OAAO,EAAE,EAGtEC,EAAiB,IACrBN,EAAM,IAAmB,sBAAsB,ECbjD,SAASO,GAAkB,CAChC,OAAOC,EAAa,CAClB,SAAU,CAAC,aAAa,EACxB,QAAS,SAAY,CACb,MAAAC,GAAW,MAAMV,EAAA,GAAc,KAC7B,OAAAU,EAAA,KAAK,CAACC,EAAGC,IAAMD,EAAE,KAAK,cAAcC,EAAE,IAAI,CAAC,EAC5CF,CACT,EACA,UAAW,IAAO,GAAK,CAAA,CACxB,CACH,CAEa,MAAAG,EAAsB,CAAC,cAAc,EAE3C,SAASC,GAAsB,CACpC,OAAOL,EAAa,CAClB,SAAUI,EACV,QAAS,UAAa,MAAMN,EAAA,GAAkB,IAAA,CAC/C,CACH"}