Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(room): room detail request failed #1165

Merged
merged 1 commit into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = {
"debug",
"github",
"style",
"room",
],
],
"scope-case": [2, "always", ["lower-case", "kebab-case"]],
Expand Down
1 change: 1 addition & 0 deletions cspell.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module.exports = {
"Buildin", // @netless/widnow-manager
"zindex", // antd
"geogebra", // @netless/app-geogebra
"commitlintrc", // @commitlint/cli

// misc
"npmrc",
Expand Down
12 changes: 11 additions & 1 deletion desktop/renderer-app/src/pages/RoomDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { RoomStatus } from "../../api-middleware/flatServer/constants";
import { message } from "antd";
import { FLAT_WEB_BASE_URL } from "../../constants/process";
import { useTranslation } from "react-i18next";
import { ServerRequestError } from "../../utils/error/server-request-error";
import { RequestErrorCode } from "../../constants/error-code";

export const RoomDetailPage = observer<{}>(function RoomDetailPage() {
useWindowSize("Main");
Expand All @@ -31,7 +33,15 @@ export const RoomDetailPage = observer<{}>(function RoomDetailPage() {

useEffect(() => {
if (periodicUUID) {
roomStore.syncPeriodicSubRoomInfo({ roomUUID, periodicUUID }).catch(errorTips);
roomStore.syncPeriodicSubRoomInfo({ roomUUID, periodicUUID }).catch(error => {
if (
error instanceof ServerRequestError &&
error.errorCode !== RequestErrorCode.PeriodicNotFound
) {
// periodic canceled
errorTips(error);
}
});
} else {
roomStore.syncOrdinaryRoomInfo(roomUUID).catch(errorTips);
}
Expand Down
21 changes: 15 additions & 6 deletions web/flat-web/src/pages/RoomDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import { joinRoomHandler } from "../utils/join-room-handler";
import { RoomStatus } from "../../api-middleware/flatServer/constants";
import { message } from "antd";
import { FLAT_WEB_BASE_URL } from "../../constants/process";

/**
* TODO: we forget set i18n in current file!!!
*/
import { useTranslation } from "react-i18next";
import { ServerRequestError } from "renderer-app/src/utils/error/server-request-error";
import { RequestErrorCode } from "renderer-app/src/constants/error-code";

export const RoomDetailPage = observer(function RoomDetailPage() {
const { t } = useTranslation();

const { roomUUID, periodicUUID } = useParams<RouteParams<RouteNameType.RoomDetailPage>>();
const pushHistory = usePushHistory();
const history = useHistory();
Expand All @@ -33,7 +34,15 @@ export const RoomDetailPage = observer(function RoomDetailPage() {

useEffect(() => {
if (periodicUUID) {
roomStore.syncPeriodicSubRoomInfo({ roomUUID, periodicUUID }).catch(errorTips);
roomStore.syncPeriodicSubRoomInfo({ roomUUID, periodicUUID }).catch(error => {
if (
error instanceof ServerRequestError &&
error.errorCode !== RequestErrorCode.PeriodicNotFound
) {
// periodic canceled
errorTips(error);
}
});
} else {
roomStore.syncOrdinaryRoomInfo(roomUUID).catch(errorTips);
}
Expand Down Expand Up @@ -85,7 +94,7 @@ export const RoomDetailPage = observer(function RoomDetailPage() {
errorTips(err);
}

void message.success("已取消该房间");
void message.success(t("the-room-has-been-cancelled"));

history.goBack();
}
Expand Down