Skip to content

Commit

Permalink
fix(web): try to fix chrome permission popup (#1057)
Browse files Browse the repository at this point in the history
Co-authored-by: Black-Hole <158blackhole@gmail.com>
  • Loading branch information
hyrious and BlackHole1 authored Nov 4, 2021
1 parent f7a0ad4 commit dae0386
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions web/flat-web/src/pages/utils/join-room-handler.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
import { RouteNameType, usePushHistory } from "../../utils/routes";
import { generateRoutePath, RouteNameType, usePushHistory } from "../../utils/routes";
import { roomStore } from "../../stores/room-store";
import { RoomType } from "../../api-middleware/flatServer/constants";
import { errorTips } from "../../components/Tips/ErrorTips";

export const joinRoomHandler = async (
roomUUID: string,
pushHistory: ReturnType<typeof usePushHistory>,
_pushHistory: ReturnType<typeof usePushHistory>,
): Promise<void> => {
try {
const formatRoomUUID = roomUUID.replace(/\s+/g, "");
const data = await roomStore.joinRoom(formatRoomUUID);
// try to work around chrome does not show permission popup after
// soft navigating. here we do a "hard" navigating instead.
// @TODO make roomType a param
switch (data.roomType) {
case RoomType.BigClass: {
pushHistory(RouteNameType.BigClassPage, data);
// pushHistory(RouteNameType.BigClassPage, data);
window.location.href = generateRoutePath(RouteNameType.BigClassPage, data);
break;
}
case RoomType.SmallClass: {
pushHistory(RouteNameType.SmallClassPage, data);
// pushHistory(RouteNameType.SmallClassPage, data);
window.location.href = generateRoutePath(RouteNameType.SmallClassPage, data);
break;
}
case RoomType.OneToOne: {
pushHistory(RouteNameType.OneToOnePage, data);
// pushHistory(RouteNameType.OneToOnePage, data);
window.location.href = generateRoutePath(RouteNameType.OneToOnePage, data);
break;
}
default: {
Expand Down

0 comments on commit dae0386

Please sign in to comment.