Skip to content

Commit

Permalink
fix(verification): error messages
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <[email protected]>
  • Loading branch information
virtual-designer authored Aug 27, 2024
1 parent 66947a5 commit ad75ace
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/verification/verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export const verifyMember = async (payload: VerifyMemberPayload) => {
},
);

return res.data;
return res.data as { success: boolean; error?: string };
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Guild } from "@/types/Guild";
import { LinearProgress } from "@mui/material";
import { Spacer } from "@nextui-org/react";
import { useMutation } from "@tanstack/react-query";
import { AxiosError } from "axios";
import { FC, ReactNode, useEffect, useRef, useState } from "react";
import { BsCheckCircle } from "react-icons/bs";
import { HiOutlineExclamationCircle } from "react-icons/hi2";
Expand Down Expand Up @@ -123,7 +124,9 @@ const GuildVerificationGate: FC<GuildVerificationGateProps> = ({
<div className="flex items-center gap-1 pb-2">
<HiOutlineExclamationCircle className="text-red-500 text-xl" />
<p className="text-red-500 text-sm text-center">
{error?.message ?? "We were unable to verify you."}
{(error instanceof AxiosError
? error?.response?.data?.error
: null) ?? "We were unable to verify you."}
</p>
</div>
)}
Expand Down

0 comments on commit ad75ace

Please sign in to comment.