Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1022 B
Raw Blame
'use client';

import { Flexbox, Text } from '@lobehub/ui';
import { memo, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';

import BrandLoading from '@/components/Loading/BrandTextLoading';

interface BuiltinConsentProps {
  uid: string;
}

const BuiltinConsent = memo<BuiltinConsentProps>(({ uid }) => {
  const { t } = useTranslation('oauth');
  const formRef = useRef<HTMLFormElement>(null);

  useEffect(() => {
    // Auto-submit on mount
    formRef.current?.submit();
  }, []);

  return (
    <>
      <Flexbox align={'center'} gap={12}>
        <BrandLoading debugId={'ouidc'} />
        <Text fontSize={14}>{t('consent.redirecting')}</Text>
      </Flexbox>
      <form action="/oidc/consent" method="post" ref={formRef} style={{ display: 'none' }}>
        <input name="uid" type="hidden" value={uid} />
        <input name="consent" type="hidden" value="accept" />
      </form>
    </>
  );
});

BuiltinConsent.displayName = 'BuiltinConsent';

export default BuiltinConsent;