2022-02-09 11:44:08 +05:30
|
|
|
import axios from 'api';
|
|
|
|
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
|
|
|
|
import { AxiosError } from 'axios';
|
|
|
|
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
2022-05-03 15:27:09 +05:30
|
|
|
import { PayloadProps } from 'types/api/user/getPendingInvites';
|
2022-02-09 11:44:08 +05:30
|
|
|
|
2022-05-03 15:27:09 +05:30
|
|
|
const getPendingInvites = async (): Promise<
|
|
|
|
|
SuccessResponse<PayloadProps> | ErrorResponse
|
|
|
|
|
> => {
|
2022-02-09 11:44:08 +05:30
|
|
|
try {
|
2022-05-03 15:27:09 +05:30
|
|
|
const response = await axios.get(`/invite`);
|
2022-02-09 11:44:08 +05:30
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
error: null,
|
|
|
|
|
message: response.data.status,
|
|
|
|
|
payload: response.data,
|
|
|
|
|
};
|
|
|
|
|
} catch (error) {
|
|
|
|
|
return ErrorResponseHandler(error as AxiosError);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2022-05-03 15:27:09 +05:30
|
|
|
export default getPendingInvites;
|