diff --git a/apps/frontend/src/components/layout/settings.component.tsx b/apps/frontend/src/components/layout/settings.component.tsx index 436f7fe99..f4d56eea2 100644 --- a/apps/frontend/src/components/layout/settings.component.tsx +++ b/apps/frontend/src/components/layout/settings.component.tsx @@ -38,7 +38,7 @@ export const SettingsPopup: FC<{ getRef?: Ref }> = (props) => { }, []); const url = useSearchParams(); - const showLogout = !url.get('onboarding'); + const showLogout = !url.get('onboarding') || user?.tier?.current === "FREE"; const loadProfile = useCallback(async () => { const personal = await (await fetch('/user/personal')).json(); diff --git a/apps/frontend/src/middleware.ts b/apps/frontend/src/middleware.ts index e669efb6c..28e22680a 100644 --- a/apps/frontend/src/middleware.ts +++ b/apps/frontend/src/middleware.ts @@ -1,7 +1,7 @@ import { NextResponse } from 'next/server'; import type { NextRequest } from 'next/server'; -import { fetchBackend } from '@gitroom/helpers/utils/custom.fetch.func'; import { getCookieUrlFromDomain } from '@gitroom/helpers/subdomain/subdomain.management'; +import { internalFetch } from '@gitroom/helpers/utils/internal.fetch'; // This function can be marked `async` if using `await` inside export async function middleware(request: NextRequest) { @@ -68,13 +68,10 @@ export async function middleware(request: NextRequest) { try { if (org) { const { id } = await ( - await fetchBackend('/user/join-org', { + await internalFetch('/user/join-org', { body: JSON.stringify({ org, }), - headers: { - auth: authCookie?.value!, - }, method: 'POST', }) ).json(); diff --git a/libraries/helpers/src/utils/custom.fetch.func.ts b/libraries/helpers/src/utils/custom.fetch.func.ts index f7f38c072..9daf222d5 100644 --- a/libraries/helpers/src/utils/custom.fetch.func.ts +++ b/libraries/helpers/src/utils/custom.fetch.func.ts @@ -1,4 +1,3 @@ -import { loadVars } from '@gitroom/react/helpers/variable.context'; export interface Params { baseUrl: string; @@ -48,6 +47,6 @@ export const customFetch = ( export const fetchBackend = customFetch({ get baseUrl() { - return loadVars().backendUrl; + return process.env.BACKEND_URL!; }, }); diff --git a/libraries/nestjs-libraries/src/database/prisma/organizations/organization.service.ts b/libraries/nestjs-libraries/src/database/prisma/organizations/organization.service.ts index db239ac3a..15336c34f 100644 --- a/libraries/nestjs-libraries/src/database/prisma/organizations/organization.service.ts +++ b/libraries/nestjs-libraries/src/database/prisma/organizations/organization.service.ts @@ -46,7 +46,7 @@ export class OrganizationService { } async inviteTeamMember(orgId: string, body: AddTeamMemberDto) { - const timeLimit = dayjs().add(15, 'minutes').format('YYYY-MM-DD HH:mm:ss'); + const timeLimit = dayjs().add(1, 'hour').format('YYYY-MM-DD HH:mm:ss'); const id = makeId(5); const url = process.env.FRONTEND_URL + @@ -55,7 +55,7 @@ export class OrganizationService { await this._notificationsService.sendEmail( body.email, 'You have been invited to join an organization', - `You have been invited to join an organization. Click here to join.
The link will expire in 15 minutes.` + `You have been invited to join an organization. Click here to join.
The link will expire in 1 hour.` ); } return { url };