(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": {
"@tailwindcss/forms": "^0.5.7",
"@types/node": "^20",
"@types/react": "^18",
"@types/react": "18.2.48",
"@types/react-dom": "^18",
"autoprefixer": "^10.4.17",
"eslint": "^8",
"eslint-config-next": "14.1.0",
"postcss": "^8.4.33",
"tailwindcss": "^3.4.1",
"typescript": "^5"
"typescript": "5.3.3"
}
},
"node_modules/@aashutoshrathi/word-wrap": {

View file

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

View file

@ -35,18 +35,39 @@ const UserDashboard = () => {
}
}, [userID, accessToken, proxyBaseUrl, data]);
if (!userID || !accessToken || !proxyBaseUrl || !data) {
if (proxyBaseUrl == null) {
return (
<Card
className="max-w-xs mx-auto"
decoration="top"
decorationColor="indigo"
>
<Text>Login to create/delete keys</Text>
</Card>
<div>
<EnterProxyUrl onUrlChange={handleProxyUrlChange} />
</div>
);
}
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 (
<Grid numItems={1} className="gap-0 p-10 h-[75vh] w-full">
<Col numColSpan={1}>