Skip to content

Commit

Permalink
fix: approver bug
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarkhanzadian committed Dec 23, 2024
1 parent fda7be0 commit ad23f44
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ export const ApproverProvider = approverContext.Provider;
export function useApproverContext() {
const context = useContext(approverContext);
if (!context) throw new Error('`useApproverContext` must be used within a `ApproverProvider`');
const url = new URL(context?.requester ?? '');
return { ...context, hostname: url.hostname };
let hostname: string | undefined = undefined;
if (context.requester) {
hostname = new URL(context.requester).hostname;
}
return { ...context, hostname };
}

export function useRegisterApproverChildren() {
Expand Down

0 comments on commit ad23f44

Please sign in to comment.