fix: merging from the main
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { type AxiosError, type AxiosResponse } from "axios";
|
||||
import Report from "@/ApiClasses/Repport";
|
||||
import ProjectDecision from "@/ApiClasses/ProjectDecision";
|
||||
import UserAdmin from "@/ApiClasses/UserAdmin";
|
||||
import {
|
||||
axiosInstance,
|
||||
defaultApiErrorHandler,
|
||||
@@ -297,6 +298,29 @@ function grantAdminRights(
|
||||
});
|
||||
}
|
||||
|
||||
function createAdmin(
|
||||
onSuccessHandler?: (response: AxiosResponse) => void,
|
||||
onErrorHandler?: (error: AxiosError) => void
|
||||
): void {
|
||||
axiosInstance
|
||||
.post("/admin/create-account")
|
||||
.then((response) => {
|
||||
if (onSuccessHandler) {
|
||||
onSuccessHandler(response);
|
||||
} else {
|
||||
defaultApiSuccessHandler(response);
|
||||
}
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
if (onErrorHandler) {
|
||||
onErrorHandler(error);
|
||||
} else {
|
||||
defaultApiErrorHandler(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export {
|
||||
axiosInstance,
|
||||
//requestJoinProject, // Not yet implemented [cite: 4]
|
||||
@@ -313,4 +337,5 @@ export {
|
||||
getUpcomingAppointments,
|
||||
removeProject,
|
||||
grantAdminRights,
|
||||
createAdmin,
|
||||
};
|
||||
|
Reference in New Issue
Block a user