-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from RBND-studio/dev
Merge dev
- Loading branch information
Showing
24 changed files
with
429 additions
and
247 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
25 changes: 25 additions & 0 deletions
25
apps/app/src/app/(dashboard)/accept-invite/[inviteId]/page.tsx
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,25 @@ | ||
import { DashboardError } from "components/ui/dashboard-error"; | ||
import { api } from "lib/api"; | ||
import { load } from "lib/load"; | ||
import { redirect } from "next/navigation"; | ||
import { routes } from "routes"; | ||
|
||
type Props = { | ||
params: { inviteId: string }; | ||
}; | ||
|
||
export default async function AcceptInvitePage({ | ||
params: { inviteId }, | ||
}: Props): Promise<JSX.Element> { | ||
try { | ||
const res = await load(api["POST /invites/:inviteId/accept"](inviteId)); | ||
redirect(routes.organization({ organizationId: res.organization_id })); | ||
} catch (err) { | ||
return ( | ||
<DashboardError | ||
title="Error accepting invite" | ||
errorMessage={err instanceof Error ? err.message : "Something went wrong"} | ||
/> | ||
); | ||
} | ||
} |
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,26 @@ | ||
import { Flex } from "@flows/styled-system/jsx"; | ||
import Link from "next/link"; | ||
import { type FC } from "react"; | ||
import { routes } from "routes"; | ||
import { Button, Text } from "ui"; | ||
|
||
type Props = { | ||
title: string; | ||
errorMessage: string; | ||
}; | ||
|
||
export const DashboardError: FC<Props> = ({ errorMessage, title }) => { | ||
return ( | ||
<Flex align="center" justifyContent="center" direction="column" height="100vh"> | ||
<Text mb="space8" variant="titleL"> | ||
{title} | ||
</Text> | ||
<Text color="muted" mb="space24"> | ||
{errorMessage} | ||
</Text> | ||
<Button asChild> | ||
<Link href={routes.home}>Go back</Link> | ||
</Button> | ||
</Flex> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
export const isLocalhost = (origin: string): boolean => | ||
["http://localhost", "https://localhost", "http://127.0.0.1", "https://127.0.0.1"].some((o) => | ||
origin.startsWith(o), | ||
export const isLocalhost = (origin: string): boolean => { | ||
const url = new URL(origin); | ||
const originWithoutPort = `${url.protocol}//${url.hostname}`; | ||
|
||
return ["http://localhost", "https://localhost", "http://127.0.0.1", "https://127.0.0.1"].some( | ||
(o) => o === originWithoutPort, | ||
); | ||
}; |
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,7 @@ | ||
import { HttpException, HttpStatus } from "@nestjs/common"; | ||
|
||
export class TooManyRequestsException extends HttpException { | ||
constructor(message?: string) { | ||
super(message ?? "Too Many Requests", HttpStatus.TOO_MANY_REQUESTS); | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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.