Started implementing the roles permissions

This commit is contained in:
Tiago Ribeiro
2024-10-10 19:13:18 +01:00
parent c43ab9a911
commit 55204e2ce1
67 changed files with 1357 additions and 1134 deletions

View File

@@ -44,7 +44,15 @@ export const convertBase64 = (file: File) => {
});
};
export const redirect = (destination: string) => ({
redirect: {
destination: destination,
permanent: false,
},
})
export const mapBy = <T, K extends keyof T>(obj: T[] | undefined, key: K) => (obj || []).map((i) => i[key] as T[K]);
export const filterBy = <T>(obj: T[], key: keyof T, value: any) => obj.filter((i) => i[key] === value);
export const findBy = <T>(obj: T[], key: keyof T, value: any) => obj.find((i) => i[key] === value);
export const serialize = <T>(obj: T): T => JSON.parse(JSON.stringify(obj));