Skip to content

Commit c9d8bb9

Browse files
committed
Fix the authorization
1 parent ad7c5e8 commit c9d8bb9

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/app/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function signOut() {
2525
}
2626

2727
export function isSignedIn() {
28-
return !!localStorage.getItem(LocalStorageKeys.AccessToken);
28+
return !!localStorage.getItem(LocalStorageKeys.AccessToken)?.trim();
2929
}
3030

3131
export async function refreshAccessToken(client: AxiosInstance) {

src/hooks/useAuth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type HookReturnType = [
1111
Optional<AccessTokenResponse>,
1212
boolean,
1313
boolean,
14-
Optional<FetchBaseQueryError | SerializedError>
14+
Optional<FetchBaseQueryError | SerializedError | TypeError>
1515
];
1616

1717
export function useAuth(): HookReturnType {

src/pages/Login/Login.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getConfig } from '../../app/config';
2+
import { useAuth } from '../../hooks/useAuth';
23
import Container from '@mui/material/Container';
34
import CssBaseline from '@mui/material/CssBaseline';
45
import Box from '@mui/material/Box';
@@ -10,7 +11,7 @@ import GitHubIcon from '@mui/icons-material/GitHub';
1011
import Alert from '@mui/material/Alert';
1112
import { useAuth } from '../../hooks/useAuth';
1213

13-
const { redirectUrl, githubClientId } = getConfig();
14+
const { githubClientId } = getConfig();
1415

1516
export default function Login() {
1617
const [, isLoading, , error] = useAuth();
@@ -50,7 +51,7 @@ export default function Login() {
5051
<Box component="form" noValidate>
5152
<Button
5253
fullWidth
53-
href={`https://github.com/login/oauth/authorize?scope=user&client_id=${githubClientId}&redirect_uri=${redirectUrl}`}
54+
href={`https://github.com/login/oauth/authorize?scope=user&client_id=${githubClientId}`}
5455
type="submit"
5556
variant="contained"
5657
sx={{ mt: 3, mb: 2 }}

0 commit comments

Comments
 (0)