mirror of
https://github.com/documenso/documenso.git
synced 2025-11-25 14:11:43 +10:00
fix: wip
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
import { redirect } from 'react-router';
|
||||
import { getLoaderSession } from 'server/utils/get-loader-session';
|
||||
|
||||
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
|
||||
|
||||
import type { Route } from './+types/_index';
|
||||
|
||||
export function loader({ context }: Route.LoaderArgs) {
|
||||
if (!context.session?.currentTeam) {
|
||||
export function loader() {
|
||||
const { currentTeam } = getLoaderSession();
|
||||
if (!currentTeam) {
|
||||
throw redirect('/documents');
|
||||
}
|
||||
|
||||
throw redirect(formatDocumentsPath(context.session.currentTeam.url));
|
||||
throw redirect(formatDocumentsPath(currentTeam.url));
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import { Trans, msg } from '@lingui/macro';
|
||||
import { useLingui } from '@lingui/react';
|
||||
import { ChevronLeft } from 'lucide-react';
|
||||
import { Link, Outlet, isRouteErrorResponse, redirect, useNavigate } from 'react-router';
|
||||
import { getRequiredLoaderSession } from 'server/utils/get-loader-session';
|
||||
import { getLoaderSession } from 'server/utils/get-loader-session';
|
||||
import { match } from 'ts-pattern';
|
||||
|
||||
import { AppErrorCode } from '@documenso/lib/errors/app-error';
|
||||
@ -14,8 +14,8 @@ import { TeamProvider } from '~/providers/team';
|
||||
|
||||
import type { Route } from './+types/_layout';
|
||||
|
||||
export const loader = ({ context }: Route.LoaderArgs) => {
|
||||
const { currentTeam } = getRequiredLoaderSession(context);
|
||||
export const loader = () => {
|
||||
const { currentTeam } = getLoaderSession();
|
||||
|
||||
if (!currentTeam) {
|
||||
throw redirect('/documents');
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
import { Trans } from '@lingui/macro';
|
||||
import { Outlet } from 'react-router';
|
||||
import { getRequiredLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
import { getLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
|
||||
import { canExecuteTeamAction } from '@documenso/lib/utils/teams';
|
||||
|
||||
import { TeamSettingsNavDesktop } from '~/components/general/teams/team-settings-nav-desktop';
|
||||
import { TeamSettingsNavMobile } from '~/components/general/teams/team-settings-nav-mobile';
|
||||
|
||||
import type { Route } from '../+types/_layout';
|
||||
|
||||
export function loader({ context }: Route.LoaderArgs) {
|
||||
const { currentTeam: team } = getRequiredLoaderTeamSession(context);
|
||||
export function loader() {
|
||||
const { currentTeam: team } = getLoaderTeamSession();
|
||||
|
||||
if (!team || !canExecuteTeamAction('MANAGE_TEAM', team.currentTeamMember.role)) {
|
||||
throw new Response(null, { status: 401 }); // Unauthorized.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Plural, Trans, msg } from '@lingui/macro';
|
||||
import { useLingui } from '@lingui/react';
|
||||
import { DateTime } from 'luxon';
|
||||
import { getRequiredLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
import { getLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
import type Stripe from 'stripe';
|
||||
import { match } from 'ts-pattern';
|
||||
|
||||
@ -15,8 +15,8 @@ import { TeamSettingsBillingInvoicesTable } from '~/components/tables/team-setti
|
||||
|
||||
import type { Route } from './+types/billing';
|
||||
|
||||
export async function loader({ context }: Route.LoaderArgs) {
|
||||
const { currentTeam: team } = getRequiredLoaderTeamSession(context);
|
||||
export async function loader() {
|
||||
const { currentTeam: team } = getLoaderTeamSession();
|
||||
|
||||
let teamSubscription: Stripe.Subscription | null = null;
|
||||
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
import { getRequiredLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
import { getLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
|
||||
import { getTeamPublicProfile } from '@documenso/lib/server-only/team/get-team-public-profile';
|
||||
|
||||
import PublicProfilePage from '~/routes/_authenticated+/settings+/public-profile+/index';
|
||||
|
||||
import type { Route } from './+types/public-profile';
|
||||
|
||||
export async function loader({ context }: Route.LoaderArgs) {
|
||||
const { user, currentTeam: team } = getRequiredLoaderTeamSession(context);
|
||||
export async function loader() {
|
||||
const { user, currentTeam: team } = getLoaderTeamSession();
|
||||
|
||||
const { profile } = await getTeamPublicProfile({
|
||||
userId: user.id,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Trans } from '@lingui/macro';
|
||||
import { useLingui } from '@lingui/react';
|
||||
import { DateTime } from 'luxon';
|
||||
import { getRequiredLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
import { getLoaderTeamSession } from 'server/utils/get-loader-session';
|
||||
|
||||
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
|
||||
import { getTeamTokens } from '@documenso/lib/server-only/public-api/get-all-team-tokens';
|
||||
@ -12,8 +12,8 @@ import { ApiTokenForm } from '~/components/forms/token';
|
||||
|
||||
import type { Route } from './+types/tokens';
|
||||
|
||||
export async function loader({ context }: Route.LoaderArgs) {
|
||||
const { user, currentTeam: team } = getRequiredLoaderTeamSession(context);
|
||||
export async function loader() {
|
||||
const { user, currentTeam: team } = getLoaderTeamSession();
|
||||
|
||||
const tokens = await getTeamTokens({ userId: user.id, teamId: team.id }).catch(() => null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user