mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
* userInviteForm: move API logic away from components * removes duplicate response alert * reverse api logic to handle errors * move redirection logic to component * chore: cleanup code
13 lines
430 B
TypeScript
13 lines
430 B
TypeScript
import { getBackendSrv } from '@grafana/runtime';
|
|
import { appEvents } from 'app/core/core';
|
|
import { FormModel } from './UserInviteForm';
|
|
import { AppEvents } from '@grafana/data';
|
|
|
|
export const userInviteSubmit = async (formData: FormModel) => {
|
|
try {
|
|
await getBackendSrv().post('/api/org/invites', formData);
|
|
} catch (err) {
|
|
appEvents.emit(AppEvents.alertError, ['Failed to send invitation.', err.message]);
|
|
}
|
|
};
|