mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Merge pull request #459 from Monadical-SAS/fix-room-not-found
Fix room not found error
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from http.client import HTTPException
|
|
||||||
from typing import Annotated, Optional
|
from typing import Annotated, Optional
|
||||||
|
|
||||||
import reflector.auth as auth
|
import reflector.auth as auth
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
from fastapi_pagination import Page
|
from fastapi_pagination import Page
|
||||||
from fastapi_pagination.ext.databases import paginate
|
from fastapi_pagination.ext.databases import paginate
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|||||||
import { Box, Button, Text, VStack, HStack, Spinner } from "@chakra-ui/react";
|
import { Box, Button, Text, VStack, HStack, Spinner } from "@chakra-ui/react";
|
||||||
import useRoomMeeting from "./useRoomMeeting";
|
import useRoomMeeting from "./useRoomMeeting";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
import { notFound } from "next/navigation";
|
||||||
import useSessionStatus from "../lib/useSessionStatus";
|
import useSessionStatus from "../lib/useSessionStatus";
|
||||||
|
|
||||||
export type RoomDetails = {
|
export type RoomDetails = {
|
||||||
@@ -34,6 +35,17 @@ export default function Room(details: RoomDetails) {
|
|||||||
setConsentGiven(consent);
|
setConsentGiven(consent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
!isLoading &&
|
||||||
|
meeting?.error &&
|
||||||
|
"status" in meeting.error &&
|
||||||
|
meeting.error.status === 404
|
||||||
|
) {
|
||||||
|
notFound();
|
||||||
|
}
|
||||||
|
}, [isLoading, meeting?.error]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isLoading || !isAuthenticated || !roomUrl) return;
|
if (isLoading || !isAuthenticated || !roomUrl) return;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useError } from "../(errors)/errorContext";
|
|||||||
import { Meeting } from "../api";
|
import { Meeting } from "../api";
|
||||||
import { shouldShowError } from "../lib/errorUtils";
|
import { shouldShowError } from "../lib/errorUtils";
|
||||||
import useApi from "../lib/useApi";
|
import useApi from "../lib/useApi";
|
||||||
|
import { notFound } from "next/navigation";
|
||||||
|
|
||||||
type ErrorMeeting = {
|
type ErrorMeeting = {
|
||||||
error: Error;
|
error: Error;
|
||||||
@@ -52,7 +53,7 @@ const useRoomMeeting = (
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const shouldShowHuman = shouldShowError(error);
|
const shouldShowHuman = shouldShowError(error);
|
||||||
if (shouldShowHuman) {
|
if (shouldShowHuman && error.status !== 404) {
|
||||||
setError(
|
setError(
|
||||||
error,
|
error,
|
||||||
"There was an error loading the meeting. Please try again by refreshing the page."
|
"There was an error loading the meeting. Please try again by refreshing the page."
|
||||||
|
|||||||
Reference in New Issue
Block a user