Solved some bugs related to the payment page

This commit is contained in:
Tiago Ribeiro
2024-01-15 14:52:17 +00:00
parent b7b2dca2dd
commit e47607597c
4 changed files with 30 additions and 18 deletions

10
src/utils/groups.ts Normal file
View File

@@ -0,0 +1,10 @@
import {Group, User} from "@/interfaces/user";
import axios from "axios";
export const isUserFromCorporate = async (userID: string) => {
const groups = (await axios.get<Group[]>(`/api/groups?participant=${userID}`)).data;
const users = (await axios.get<User[]>("/api/users/list")).data;
const adminTypes = groups.map((g) => users.find((u) => u.id === g.admin)?.type);
return adminTypes.includes("corporate");
};