mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-08 03:36:37 +00:00
🚧 working on the approval feed
This commit is contained in:
@@ -257,6 +257,8 @@
|
|||||||
"accessRolesSearch": "Search roles...",
|
"accessRolesSearch": "Search roles...",
|
||||||
"accessRolesAdd": "Add Role",
|
"accessRolesAdd": "Add Role",
|
||||||
"accessRoleDelete": "Delete Role",
|
"accessRoleDelete": "Delete Role",
|
||||||
|
"accessApprovalsManage": "Manage Approvals",
|
||||||
|
"accessApprovalsDescription": "Manage approval requests in the organization",
|
||||||
"description": "Description",
|
"description": "Description",
|
||||||
"inviteTitle": "Open Invitations",
|
"inviteTitle": "Open Invitations",
|
||||||
"inviteDescription": "Manage invitations for other users to join the organization",
|
"inviteDescription": "Manage invitations for other users to join the organization",
|
||||||
|
|||||||
@@ -1,5 +1,49 @@
|
|||||||
export interface ApprovalFeedPageProps {}
|
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||||
|
import { internal } from "@app/lib/api";
|
||||||
|
import { authCookieHeader } from "@app/lib/api/cookies";
|
||||||
|
import { getCachedOrg } from "@app/lib/api/getCachedOrg";
|
||||||
|
import OrgProvider from "@app/providers/OrgProvider";
|
||||||
|
import type { ListApprovalsResponse } from "@server/private/routers/approvals";
|
||||||
|
import type { GetOrgResponse } from "@server/routers/org";
|
||||||
|
import type { AxiosResponse } from "axios";
|
||||||
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export default function ApprovalFeedPage(props: ApprovalFeedPageProps) {
|
export interface ApprovalFeedPageProps {
|
||||||
return <></>;
|
params: Promise<{ orgId: string }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function ApprovalFeedPage(props: ApprovalFeedPageProps) {
|
||||||
|
const params = await props.params;
|
||||||
|
|
||||||
|
let approvals: ListApprovalsResponse["approvals"] = [];
|
||||||
|
const res = await internal
|
||||||
|
.get<
|
||||||
|
AxiosResponse<ListApprovalsResponse>
|
||||||
|
>(`/org/${params.orgId}/approvals`, await authCookieHeader())
|
||||||
|
.catch((e) => {});
|
||||||
|
|
||||||
|
if (res && res.status === 200) {
|
||||||
|
approvals = res.data.data.approvals;
|
||||||
|
}
|
||||||
|
|
||||||
|
let org: GetOrgResponse | null = null;
|
||||||
|
const orgRes = await getCachedOrg(params.orgId);
|
||||||
|
|
||||||
|
if (orgRes && orgRes.status === 200) {
|
||||||
|
org = orgRes.data.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
const t = await getTranslations();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SettingsSectionTitle
|
||||||
|
title={t("accessApprovalsManage")}
|
||||||
|
description={t("accessApprovalsDescription")}
|
||||||
|
/>
|
||||||
|
<OrgProvider org={org}>
|
||||||
|
<h1>Orgs</h1>
|
||||||
|
</OrgProvider>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import { internal } from "@app/lib/api";
|
|||||||
import { authCookieHeader } from "@app/lib/api/cookies";
|
import { authCookieHeader } from "@app/lib/api/cookies";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { GetOrgResponse } from "@server/routers/org";
|
import { GetOrgResponse } from "@server/routers/org";
|
||||||
import { cache } from "react";
|
|
||||||
import OrgProvider from "@app/providers/OrgProvider";
|
import OrgProvider from "@app/providers/OrgProvider";
|
||||||
import { ListRolesResponse } from "@server/routers/role";
|
import { ListRolesResponse } from "@server/routers/role";
|
||||||
import RolesTable, { type RoleRow } from "@app/components/RolesTable";
|
import RolesTable, { type RoleRow } from "@app/components/RolesTable";
|
||||||
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
|
import { getCachedOrg } from "@app/lib/api/getCachedOrg";
|
||||||
|
|
||||||
type RolesPageProps = {
|
type RolesPageProps = {
|
||||||
params: Promise<{ orgId: string }>;
|
params: Promise<{ orgId: string }>;
|
||||||
@@ -47,14 +47,7 @@ export default async function RolesPage(props: RolesPageProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let org: GetOrgResponse | null = null;
|
let org: GetOrgResponse | null = null;
|
||||||
const getOrg = cache(async () =>
|
const orgRes = await getCachedOrg(params.orgId);
|
||||||
internal
|
|
||||||
.get<
|
|
||||||
AxiosResponse<GetOrgResponse>
|
|
||||||
>(`/org/${params.orgId}`, await authCookieHeader())
|
|
||||||
.catch((e) => {})
|
|
||||||
);
|
|
||||||
const orgRes = await getOrg();
|
|
||||||
|
|
||||||
if (orgRes && orgRes.status === 200) {
|
if (orgRes && orgRes.status === 200) {
|
||||||
org = orgRes.data.data;
|
org = orgRes.data.data;
|
||||||
|
|||||||
Reference in New Issue
Block a user