ALAMI Adnane 820c979c94
Some checks failed
Format / formatting (push) Successful in 6s
Build / build (push) Successful in 41s
CI / build (push) Failing after 11s
Format / formatting (pull_request) Successful in 6s
fix: bugs
2025-04-29 00:28:56 +02:00

59 lines
1.6 KiB
TypeScript

import { type AxiosError, type AxiosResponse } from "axios";
import {
axiosInstance,
defaultApiErrorHandler,
defaultApiSuccessHandler,
} from "@/services/api";
// Unauth API
function finalizeAccount(
onSuccessHandler?: (response: AxiosResponse) => void,
onErrorHandler?: (error: AxiosError) => void
): void {
axiosInstance
.post("/unauth/finalize")
.then((response) => {
if (onSuccessHandler) {
onSuccessHandler(response);
} else {
defaultApiSuccessHandler(response);
}
})
.catch((error: AxiosError) => {
if (onErrorHandler) {
onErrorHandler(error);
} else {
defaultApiErrorHandler(error);
}
});
}
// function requestJoinProject( // Not yet implemented [cite: 4]
// projectId: number,
// onSuccessHandler?: (response: AxiosResponse) => void,
// onErrorHandler?: (error: AxiosError) => void
// ): void {
// axiosInstance
// .post(`/unauth/request-join/${projectId}`)
// .then((response) => {
// if (onSuccessHandler) {
// onSuccessHandler(response);
// } else {
// defaultApiSuccessHandler(response);
// }
// })
// .catch((error: AxiosError) => {
// if (onErrorHandler) {
// onErrorHandler(error);
// } else {
// defaultApiErrorHandler(error);
// }
// });
// }
export {
finalizeAccount,
// requestJoinProject, // Not yet implemented [cite: 4]
};