Patch organization invitation emails expiring for existing users and billing logic affected by missing organization populate call

This commit is contained in:
Tuan Dang
2023-04-28 17:57:50 +03:00
parent 330968c7af
commit b9ae224aef
6 changed files with 26 additions and 12 deletions

View File

@@ -1,22 +1,25 @@
interface Props {
email: string;
code: string;
organizationId: string;
}
/**
* This route verifies the signup invite link
* @param {object} obj
* @param {string} obj.email - email that a user is trying to verify
* @param {string} obj.organizationId - id of organization that a user is trying to verify for
* @param {string} obj.code - code that a user received to the abovementioned email
* @returns
*/
const verifySignupInvite = ({ email, code }: Props) => fetch('/api/v1/invite-org/verify', {
const verifySignupInvite = ({ email, organizationId, code }: Props) => fetch('/api/v1/invite-org/verify', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email,
organizationId,
code
})
});

View File

@@ -51,6 +51,7 @@ export default function SignupInvite() {
const router = useRouter();
const parsedUrl = queryString.parse(router.asPath.split('?')[1]);
const token = parsedUrl.token as string;
const organizationId = parsedUrl.organization_id as string;
const email = (parsedUrl.to as string)?.replace(' ', '+').trim();
// Verifies if the information that the users entered (name, workspace) is there, and if the password matched the criteria.
@@ -190,7 +191,8 @@ export default function SignupInvite() {
onButtonPressed={async () => {
const response = await verifySignupInvite({
email,
code: token
code: token,
organizationId
});
if (response.status === 200) {
const res = await response.json();