Create access at login time

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-02-20 15:06:36 +01:00
parent 9ec950d633
commit bb28cbec0b
7 changed files with 145 additions and 105 deletions

View File

@@ -28,7 +28,7 @@ export function MainLayout(props: Props) {
}
const nda = trustCenter.nonDisclosureAgreement;
const hasPendingNDA = nda
const hasPendingNDA = data.viewer && nda
&& (!nda.viewerSignature || nda.viewerSignature.status === "PENDING" || nda.viewerSignature.status === "FAILED");
if (hasPendingNDA) {

View File

@@ -47,7 +47,7 @@ const ndaPageFragment = graphql`
fragment NDAPageFragment on TrustCenter
@refetchable(queryName: "NDAPageRefetchQuery") {
nonDisclosureAgreement @required(action: THROW) {
viewerSignature @required(action: THROW) {
viewerSignature {
id
status
consentText
@@ -124,11 +124,11 @@ export function NDAPage(props: {
);
const isProcessing
= ndaSignature.status === "ACCEPTED"
|| ndaSignature.status === "PROCESSING";
= ndaSignature?.status === "ACCEPTED"
|| ndaSignature?.status === "PROCESSING";
const isFailed = ndaSignature.status === "FAILED";
const isCompleted = ndaSignature.status === "COMPLETED";
const isFailed = ndaSignature?.status === "FAILED";
const isCompleted = ndaSignature?.status === "COMPLETED";
useEffect(() => {
if (isCompleted) {
@@ -200,11 +200,11 @@ export function NDAPage(props: {
});
const nda = trustCenter.nonDisclosureAgreement;
if (
!nda
|| !nda.viewerSignature
|| nda.viewerSignature.status === "COMPLETED"
) {
if (!viewer) {
return <Navigate to="/connect" replace />;
}
if (!nda || !nda.viewerSignature || nda.viewerSignature.status === "COMPLETED") {
return <Navigate to="/overview" replace />;
}

View File

@@ -1,4 +1,4 @@
import { Suspense, useEffect } from "react";
import { useEffect } from "react";
import { useQueryLoader } from "react-relay";
import { RelayProvider } from "#/providers/RelayProviders";

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<99908411212decf464eafa45b1fc0e04>>
* @generated SignedSource<<e22127e4a2337413e7cbe8d64f43fa95>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -19,7 +19,7 @@ export type NDAPageFragment$data = {
readonly id: string;
readonly lastError: string | null | undefined;
readonly status: ElectronicSignatureStatus;
};
} | null | undefined;
};
readonly " $fragmentType": "NDAPageFragment";
};
@@ -67,41 +67,37 @@ return {
"plural": false,
"selections": [
{
"kind": "RequiredField",
"field": {
"alias": null,
"args": null,
"concreteType": "ElectronicSignature",
"kind": "LinkedField",
"name": "viewerSignature",
"plural": false,
"selections": [
(v0/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "status",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "consentText",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "lastError",
"storageKey": null
}
],
"storageKey": null
},
"action": "THROW"
"alias": null,
"args": null,
"concreteType": "ElectronicSignature",
"kind": "LinkedField",
"name": "viewerSignature",
"plural": false,
"selections": [
(v0/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "status",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "consentText",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "lastError",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
@@ -115,6 +111,6 @@ return {
};
})();
(node as any).hash = "503859b8c00b27214f9f3253bffcb670";
(node as any).hash = "37f6ca36229313e341797c28d789035d";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5c6134b4d6615f24a63ea534c80e76c1>>
* @generated SignedSource<<2b8f94503fe145fb141255a7ba79ddac>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -161,6 +161,6 @@ return {
};
})();
(node as any).hash = "503859b8c00b27214f9f3253bffcb670";
(node as any).hash = "37f6ca36229313e341797c28d789035d";
export default node;