mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 19:26:07 +00:00
Added to auto-redirect to the no projects page
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 228 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 122 KiB |
@@ -1,19 +1,40 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
|
import Button from '~/components/basic/buttons/Button';
|
||||||
import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
|
import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
|
||||||
|
|
||||||
|
import getWorkspaces from './api/workspace/getWorkspaces';
|
||||||
|
|
||||||
export default function NoProjects() {
|
export default function NoProjects() {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const redirectUser = async () => {
|
||||||
|
const workspaces = await getWorkspaces();
|
||||||
|
if (workspaces.length > 0) {
|
||||||
|
router.push('/dashboard/' + workspaces[0]._id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// on initial load - run auth check
|
||||||
|
(async () => {
|
||||||
|
await redirectUser()
|
||||||
|
})();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='h-full flex flex-col items-center justify-center text-gray-300 text-lg text-center w-11/12 mr-auto'>
|
<div className='h-full flex flex-col items-center justify-center text-gray-300 text-lg text-center w-11/12 mr-auto'>
|
||||||
<div className='mb-4 mr-16'>
|
<div className='mb-6 mt-16 mr-16'>
|
||||||
<Image
|
<Image
|
||||||
src='/images/dragon-cant-find.png'
|
src='/images/dragon-cant-find.svg'
|
||||||
height={270}
|
height={270}
|
||||||
width={436}
|
width={436}
|
||||||
alt='google logo'
|
alt='google logo'
|
||||||
></Image>
|
></Image>
|
||||||
</div>
|
</div>
|
||||||
<div className='p-4 rounded-md bg-bunker-500 mb-8 text-bunker-300 shadow-xl'>
|
<div className='px-4 rounded-md bg-bunker-500 mb-8 text-bunker-300 shadow-xl py-6'>
|
||||||
<div className='max-w-md'>
|
<div className='max-w-md'>
|
||||||
You are not part of any projects in this organization yet. When you
|
You are not part of any projects in this organization yet. When you
|
||||||
do, they will appear here.
|
do, they will appear here.
|
||||||
@@ -22,6 +43,9 @@ export default function NoProjects() {
|
|||||||
Create a new project, or ask other organization members to give you
|
Create a new project, or ask other organization members to give you
|
||||||
neccessary permissions.
|
neccessary permissions.
|
||||||
</div>
|
</div>
|
||||||
|
<div className='mt-6 mx-2'>
|
||||||
|
<Button text="Check again" onButtonPressed={redirectUser} size="md" color="mineshaft"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user