Catch Blocks
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"use server";
|
||||
import axios from "axios";
|
||||
import axios, { AxiosError } from "axios";
|
||||
|
||||
const discordAxiosClient = axios.create({
|
||||
baseURL: process.env.CORE_SERVER_URL || "http://localhost:3005",
|
||||
@@ -55,12 +55,17 @@ export const setStandardName = async ({
|
||||
memberId: string;
|
||||
userId: string;
|
||||
}) => {
|
||||
discordAxiosClient
|
||||
return discordAxiosClient
|
||||
.post("/helper/set-standard-name", {
|
||||
memberId,
|
||||
userId,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error removing roles from member:", error);
|
||||
console.log("Error removing roles from member:", error);
|
||||
return {
|
||||
error:
|
||||
((error as unknown as AxiosError).response?.data as unknown as { error: string }).error ||
|
||||
(error as unknown as AxiosError).message,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user