improve axios interceptor, remove old login info, stage selection logging

This commit is contained in:
martin-mfg
2025-11-20 17:58:34 +01:00
parent 87debbe853
commit a073740429
3 changed files with 6 additions and 28 deletions
+5 -2
View File
@@ -12,8 +12,11 @@ const cachedAxios = setupCache(axios, {
// mock username=anuraghazra requests
cachedAxios.interceptors.request.use(
(config) => {
const params = config.params || {};
if (params.username === 'anuraghazra') {
const params = new URL(config.url).entries || {};
if (
params.username === 'anuraghazra' ||
params.repo.startsWith('anuraghazra/')
) {
// Return a promise that resolves with a mocked response
return Promise.resolve({
data: 'hello anuraghazra!',
+1
View File
@@ -34,6 +34,7 @@ const HomeScreen = () => {
// for all stages
const [stage, setStage] = useState(isAuthenticated ? 1 : 0);
console.log('isAuthenticated: ', isAuthenticated, 'stage: ', stage);
// for stage one
const [selectedCard, setSelectedCard] = useState('stats');
@@ -61,32 +61,6 @@ const LoginStage = ({ setCurrItem }) => {
>
{isAuthenticated ? (
<>
{/* User is logged in */}
<div className="mb-6">
<p className="text-lg text-gray-700 mb-2">
You are logged in as{' '}
<a
href={`https://github.com/${userId}`}
target="_blank"
className="text-blue-500 hover:underline font-semibold"
>
{userId}
</a>
.
</p>
<p className="text-gray-600">
Access Level:{' '}
<strong>
{privateAccess ? 'Private Access' : 'Public Access'}
</strong>
</p>
<p className="text-sm text-gray-500 mt-1">
{privateAccess
? 'You have granted access to both public and private repositories.'
: 'You have granted access to public repositories.'}
</p>
</div>
{/* Access Level Management Buttons */}
<div className="mb-4">
{privateAccess ? (