Made it so a corporate user is not able to generate more code than they are allowed to

This commit is contained in:
Tiago Ribeiro
2023-11-10 15:41:26 +00:00
parent 82643b51d3
commit 4328a1d72d
4 changed files with 26 additions and 10 deletions

View File

@@ -40,12 +40,12 @@ export default function CodeGenerator({user}: {user: User}) {
}
if (status === 403) {
toast.error(`You do not have permission to generate a ${capitalize(type)} code!`, {toastId: "forbidden"});
toast.error(data.reason, {toastId: "forbidden"});
}
})
.catch(({response: {status}}) => {
.catch(({response: {status, data}}) => {
if (status === 403) {
toast.error(`You do not have permission to generate a ${capitalize(type)} code!`, {toastId: "forbidden"});
toast.error(data.reason, {toastId: "forbidden"});
return;
}