mirror of https://github.com/grafana/grafana
UserInviteForm: move API logic away from components (#43408)
* userInviteForm: move API logic away from components * removes duplicate response alert * reverse api logic to handle errors * move redirection logic to component * chore: cleanup codepull/43436/head
parent
39f787cbef
commit
6abced840d
@ -0,0 +1,12 @@ |
||||
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]); |
||||
} |
||||
}; |
Loading…
Reference in new issue