(fix) ishaanss changes

This commit is contained in:
ishaan-jaff 2024-01-27 18:00:20 -08:00
parent 00a25ebfb8
commit b39c53f64c
3 changed files with 33 additions and 12 deletions

View file

@ -21,14 +21,14 @@
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "^0.5.7", "@tailwindcss/forms": "^0.5.7",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^18", "@types/react": "18.2.48",
"@types/react-dom": "^18", "@types/react-dom": "^18",
"autoprefixer": "^10.4.17", "autoprefixer": "^10.4.17",
"eslint": "^8", "eslint": "^8",
"eslint-config-next": "14.1.0", "eslint-config-next": "14.1.0",
"postcss": "^8.4.33", "postcss": "^8.4.33",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "^5" "typescript": "5.3.3"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {

View file

@ -22,13 +22,13 @@
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "^0.5.7", "@tailwindcss/forms": "^0.5.7",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^18", "@types/react": "18.2.48",
"@types/react-dom": "^18", "@types/react-dom": "^18",
"autoprefixer": "^10.4.17", "autoprefixer": "^10.4.17",
"eslint": "^8", "eslint": "^8",
"eslint-config-next": "14.1.0", "eslint-config-next": "14.1.0",
"postcss": "^8.4.33", "postcss": "^8.4.33",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "^5" "typescript": "5.3.3"
} }
} }

View file

@ -35,18 +35,39 @@ const UserDashboard = () => {
} }
}, [userID, accessToken, proxyBaseUrl, data]); }, [userID, accessToken, proxyBaseUrl, data]);
if (!userID || !accessToken || !proxyBaseUrl || !data) { if (proxyBaseUrl == null) {
return ( return (
<Card <div>
className="max-w-xs mx-auto" <EnterProxyUrl onUrlChange={handleProxyUrlChange} />
decoration="top" </div>
decorationColor="indigo"
>
<Text>Login to create/delete keys</Text>
</Card>
); );
} }
else if (userID == null || accessToken == null) {
// redirect to page: ProxyBaseUrl/google-login/key/generate
sessionStorage.setItem('returnUrl', window.location.href);
// window.location.href = `${proxyBaseUrl}/google-login/key/generate`;
fetch(`${proxyBaseUrl}/google-login/key/generate`, { redirect: 'follow' })
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json();
})
.then(data => {
console.log('Response Data:', data);
})
.catch(error => {
console.error('Fetch Error:', error);
});
// after this check return value from this page
return null;
}
return ( return (
<Grid numItems={1} className="gap-0 p-10 h-[75vh] w-full"> <Grid numItems={1} className="gap-0 p-10 h-[75vh] w-full">
<Col numColSpan={1}> <Col numColSpan={1}>