( params: AdminRequestCreateParams, )
| 47 | * returns the existing request instead of creating a new one. |
| 48 | */ |
| 49 | export async function createAdminRequest( |
| 50 | params: AdminRequestCreateParams, |
| 51 | ): Promise<AdminRequest> { |
| 52 | const { accessToken, orgUUID } = await prepareApiRequest() |
| 53 | |
| 54 | const headers = { |
| 55 | ...getOAuthHeaders(accessToken), |
| 56 | 'x-organization-uuid': orgUUID, |
| 57 | } |
| 58 | |
| 59 | const url = `${getOauthConfig().BASE_API_URL}/api/oauth/organizations/${orgUUID}/admin_requests` |
| 60 | |
| 61 | const response = await axios.post<AdminRequest>(url, params, { headers }) |
| 62 | |
| 63 | return response.data |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Get pending admin request of a specific type for the current user. |
no test coverage detected