-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to configure user agreements for the register user form (#1464)
- Loading branch information
Showing
29 changed files
with
548 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
import { ActionUnion, createAction, ThunkAction } from 'utils/redux'; | ||
import getCore from 'cvat-core-wrapper'; | ||
import { UserAgreement } from 'reducers/interfaces' | ||
|
||
const core = getCore(); | ||
|
||
export enum UserAgreementsActionTypes { | ||
GET_USER_AGREEMENTS = 'GET_USER_AGREEMENTS', | ||
GET_USER_AGREEMENTS_SUCCESS = 'GET_USER_AGREEMENTS_SUCCESS', | ||
GET_USER_AGREEMENTS_FAILED = 'GET_USER_AGREEMENTS_FAILED', | ||
} | ||
|
||
const userAgreementsActions = { | ||
getUserAgreements: () => createAction(UserAgreementsActionTypes.GET_USER_AGREEMENTS), | ||
getUserAgreementsSuccess: (userAgreements: UserAgreement[]) => | ||
createAction(UserAgreementsActionTypes.GET_USER_AGREEMENTS_SUCCESS, userAgreements), | ||
getUserAgreementsFailed: (error: any) => | ||
createAction(UserAgreementsActionTypes.GET_USER_AGREEMENTS_FAILED, { error }), | ||
}; | ||
|
||
export type UserAgreementsActions = ActionUnion<typeof userAgreementsActions>; | ||
|
||
export const getUserAgreementsAsync = (): ThunkAction => async (dispatch): Promise<void> => { | ||
dispatch(userAgreementsActions.getUserAgreements()); | ||
|
||
try { | ||
const userAgreements = await core.server.userAgreements(); | ||
dispatch( | ||
userAgreementsActions.getUserAgreementsSuccess(userAgreements), | ||
); | ||
} catch (error) { | ||
dispatch(userAgreementsActions.getUserAgreementsFailed(error)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.