chore(frontend): changed source code to src folder from root

This commit is contained in:
akhilmhdh
2023-01-16 00:34:22 +05:30
parent c563548a1c
commit 63e9d83ba4
193 changed files with 280 additions and 33 deletions
+34
View File
@@ -0,0 +1,34 @@
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import getWorkspaces from './api/workspace/getWorkspaces';
export default function DashboardRedirect() {
const router = useRouter();
/**
* Here we forward to the default workspace if a user opens this url
*/
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => {
(async () => {
let userWorkspace;
try {
if (localStorage.getItem('projectData.id')) {
router.push('/dashboard/' + localStorage.getItem('projectData.id'));
} else {
const userWorkspaces = await getWorkspaces();
userWorkspace = userWorkspaces[0]._id;
router.push('/dashboard/' + userWorkspace);
}
} catch (error) {
console.log('Error - Not logged in yet');
}
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return <div></div>;
}
DashboardRedirect.requireAuth = true;