mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-17 22:21:37 +08:00
28 lines
656 B
TypeScript
28 lines
656 B
TypeScript
import axios from 'api';
|
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
|
import { AxiosError } from 'axios';
|
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
|
import { Props } from 'types/api/user/signup';
|
|
|
|
const signup = async (
|
|
props: Props,
|
|
): Promise<SuccessResponse<undefined> | ErrorResponse> => {
|
|
try {
|
|
const response = await axios.post(`/user`, {
|
|
email: props.email,
|
|
name: props.name,
|
|
});
|
|
|
|
return {
|
|
statusCode: 200,
|
|
error: null,
|
|
message: response.data.status,
|
|
payload: response.data.data,
|
|
};
|
|
} catch (error) {
|
|
return ErrorResponseHandler(error as AxiosError);
|
|
}
|
|
};
|
|
|
|
export default signup;
|