improve axios interceptor, remove old login info, stage selection logging
This commit is contained in:
@@ -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!',
|
||||
|
||||
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user