Fix sentry error (#5848)
Fixes https://twenty-v7.sentry.io/issues/5363536663/?environment=prod&project=4507072499810304&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=7d&stream_index=0 - handle error properly in twenty-server - display backend error message
This commit is contained in:
@ -22,8 +22,8 @@ export const useWorkspaceFromInviteHash = () => {
|
||||
const { data: workspaceFromInviteHash, loading } =
|
||||
useGetWorkspaceFromInviteHashQuery({
|
||||
variables: { inviteHash: workspaceInviteHash || '' },
|
||||
onError: () => {
|
||||
enqueueSnackBar('workspace does not exist', {
|
||||
onError: (error) => {
|
||||
enqueueSnackBar(error.message, {
|
||||
variant: SnackBarVariant.Error,
|
||||
});
|
||||
navigate(AppPath.Index);
|
||||
|
||||
@ -82,9 +82,15 @@ export class AuthResolver {
|
||||
async findWorkspaceFromInviteHash(
|
||||
@Args() workspaceInviteHashValidInput: WorkspaceInviteHashValidInput,
|
||||
) {
|
||||
return await this.workspaceRepository.findOneBy({
|
||||
const workspace = await this.workspaceRepository.findOneBy({
|
||||
inviteHash: workspaceInviteHashValidInput.inviteHash,
|
||||
});
|
||||
|
||||
if (!workspace) {
|
||||
throw new BadRequestException('Workspace does not exist');
|
||||
}
|
||||
|
||||
return workspace;
|
||||
}
|
||||
|
||||
@UseGuards(CaptchaGuard)
|
||||
|
||||
Reference in New Issue
Block a user