feat: Modified discussions FE so that ONLY users with verified emails (#789)

* feat: Modified discussions FE so that ONLY users with verified emails can create content

* feat: added comment and response functionality

* test: fixed test cases

* refactor: refactor code and added HOC

* test: added test cases

* test: added test cases for failed and denied

* feat: added states for button

* refactor: added callback function

* test: added test case to close the dialogue

* refactor: refactor function
This commit is contained in:
sundasnoreen12
2025-07-23 17:24:57 +05:00
committed by GitHub
parent 750720f648
commit 76da74ae20
19 changed files with 379 additions and 39 deletions

View File

@@ -6,7 +6,7 @@ import {
} from '../../../data/constants';
import { getHttpErrorStatus } from '../../utils';
import {
deleteThread, getThread, getThreads, postThread, updateThread,
deleteThread, getThread, getThreads, postThread, sendEmailForAccountActivation, updateThread,
} from './api';
import {
deleteThreadDenied,
@@ -26,6 +26,10 @@ import {
postThreadFailed,
postThreadRequest,
postThreadSuccess,
sendAccountActivationEmailDenied,
sendAccountActivationEmailFailed,
sendAccountActivationEmailRequest,
sendAccountActivationEmailSuccess,
updateThreadAsRead,
updateThreadDenied,
updateThreadFailed,
@@ -304,3 +308,20 @@ export function removeThread(threadId) {
}
};
}
export function sendAccountActivationEmail() {
return async (dispatch) => {
try {
dispatch(sendAccountActivationEmailRequest());
const data = await sendEmailForAccountActivation();
dispatch(sendAccountActivationEmailSuccess(camelCaseObject(data)));
} catch (error) {
if (getHttpErrorStatus(error) === 403) {
dispatch(sendAccountActivationEmailDenied());
} else {
dispatch(sendAccountActivationEmailFailed());
}
logError(error);
}
};
}