fix(setup): fix Plex login not proceeding after authentication (#2596)
This commit is contained in:
@@ -25,11 +25,14 @@ const LoginWithPlex = ({ onComplete }: LoginWithPlexProps) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
const response = await axios.post('/api/v1/auth/plex', { authToken });
|
try {
|
||||||
|
const response = await axios.post('/api/v1/auth/plex', { authToken });
|
||||||
if (response.data?.id) {
|
if (response.data?.id) {
|
||||||
const { data: user } = await axios.get('/api/v1/auth/me');
|
const { data: user } = await axios.get('/api/v1/auth/me');
|
||||||
revalidate(user, false);
|
revalidate(user, false);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// auth failed silently, user can retry again
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (authToken) {
|
if (authToken) {
|
||||||
|
|||||||
@@ -41,12 +41,17 @@ const SetupLogin: React.FC<LoginWithMediaServerProps> = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
const response = await axios.post('/api/v1/auth/plex', {
|
try {
|
||||||
authToken: authToken,
|
const response = await axios.post('/api/v1/auth/plex', {
|
||||||
});
|
authToken: authToken,
|
||||||
|
});
|
||||||
|
|
||||||
if (response.data?.email) {
|
if (response.data?.id) {
|
||||||
revalidate();
|
const { data: user } = await axios.get('/api/v1/auth/me');
|
||||||
|
revalidate(user, false);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// auth failed silently and user can attempt again
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (authToken && mediaServerType == MediaServerType.PLEX) {
|
if (authToken && mediaServerType == MediaServerType.PLEX) {
|
||||||
|
|||||||
Reference in New Issue
Block a user