Browse Source

Use typed dispatch hook.

main
Titouan Rigoudy 4 years ago
parent
commit
7d3e9be03c
6 changed files with 12 additions and 12 deletions
  1. +2
    -2
      src/modules/login/LoginStatusPane.tsx
  2. +2
    -2
      src/modules/room/RoomChat.tsx
  3. +2
    -2
      src/modules/room/RoomChatForm.tsx
  4. +2
    -2
      src/modules/room/RoomChatHeader.tsx
  5. +2
    -2
      src/modules/room/RoomList.tsx
  6. +2
    -2
      src/modules/user/UserList.tsx

+ 2
- 2
src/modules/login/LoginStatusPane.tsx View File

@ -1,6 +1,6 @@
import { FC, useEffect } from "react"; import { FC, useEffect } from "react";
import { useDispatch } from "react-redux";
import { useAppDispatch } from "app/hooks";
import { import {
loginFetchStatus, loginFetchStatus,
LoginStatus, LoginStatus,
@ -12,7 +12,7 @@ interface Props {
} }
const LoginStatusPane: FC<Props> = ({ login }) => { const LoginStatusPane: FC<Props> = ({ login }) => {
const dispatch = useDispatch();
const dispatch = useAppDispatch();
// Asynchronously fetch the login status if it is still unknown. // Asynchronously fetch the login status if it is still unknown.
useEffect(() => { useEffect(() => {


+ 2
- 2
src/modules/room/RoomChat.tsx View File

@ -1,6 +1,6 @@
import { FC, useEffect, useState } from "react"; import { FC, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import { useAppDispatch } from "app/hooks";
import { import {
RoomState, RoomState,
RoomMembership, RoomMembership,
@ -52,7 +52,7 @@ const RoomChatInner: FC<Props> = ({ loginUserName, room }) => {
// TODO: Back button on small-enough screens (below `md`). // TODO: Back button on small-enough screens (below `md`).
const RoomChat: FC<Props> = ({ loginUserName, room }) => { const RoomChat: FC<Props> = ({ loginUserName, room }) => {
const dispatch = useDispatch();
const dispatch = useAppDispatch();
useEffect(() => { useEffect(() => {
if (room.membership === RoomMembership.Left) { if (room.membership === RoomMembership.Left) {


+ 2
- 2
src/modules/room/RoomChatForm.tsx View File

@ -1,7 +1,7 @@
import { FC } from "react"; import { FC } from "react";
import { Form, Field } from "react-final-form"; import { Form, Field } from "react-final-form";
import { useDispatch } from "react-redux";
import { useAppDispatch } from "app/hooks";
import { roomSendMessage } from "modules/room/slice"; import { roomSendMessage } from "modules/room/slice";
interface Props { interface Props {
@ -14,7 +14,7 @@ interface Fields {
} }
const RoomChatForm: FC<Props> = ({ roomName, loginUserName }) => { const RoomChatForm: FC<Props> = ({ roomName, loginUserName }) => {
const dispatch = useDispatch();
const dispatch = useAppDispatch();
const onSubmit = ({ message }: Fields, form: any) => { const onSubmit = ({ message }: Fields, form: any) => {
dispatch( dispatch(


+ 2
- 2
src/modules/room/RoomChatHeader.tsx View File

@ -1,7 +1,7 @@
import { FC, ReactEventHandler } from "react"; import { FC, ReactEventHandler } from "react";
import { useDispatch } from "react-redux";
import { useHistory } from "react-router"; import { useHistory } from "react-router";
import { useAppDispatch } from "app/hooks";
import { import {
RoomState, RoomState,
RoomMembership, RoomMembership,
@ -26,7 +26,7 @@ interface Props {
const RoomChatHeader: FC<Props> = ({ room, toggleDetails }) => { const RoomChatHeader: FC<Props> = ({ room, toggleDetails }) => {
const history = useHistory(); const history = useHistory();
const dispatch = useDispatch();
const dispatch = useAppDispatch();
if (room === undefined) { if (room === undefined) {
return <InnerHeader title="Select a room" />; return <InnerHeader title="Select a room" />;


+ 2
- 2
src/modules/room/RoomList.tsx View File

@ -1,6 +1,6 @@
import { FC, ReactEventHandler } from "react"; import { FC, ReactEventHandler } from "react";
import { useDispatch } from "react-redux";
import { useAppDispatch } from "app/hooks";
import SearchableList from "components/SearchableList"; import SearchableList from "components/SearchableList";
import RoomListEntry from "modules/room/RoomListEntry"; import RoomListEntry from "modules/room/RoomListEntry";
import { RoomMap, roomGetAll } from "modules/room/slice"; import { RoomMap, roomGetAll } from "modules/room/slice";
@ -10,7 +10,7 @@ interface Props {
} }
const RoomList: FC<Props> = ({ rooms }) => { const RoomList: FC<Props> = ({ rooms }) => {
const dispatch = useDispatch();
const dispatch = useAppDispatch();
const onRefresh: ReactEventHandler = (event) => { const onRefresh: ReactEventHandler = (event) => {
event.preventDefault(); event.preventDefault();


+ 2
- 2
src/modules/user/UserList.tsx View File

@ -1,6 +1,6 @@
import { FC, ReactEventHandler } from "react"; import { FC, ReactEventHandler } from "react";
import { useDispatch } from "react-redux";
import { useAppDispatch } from "app/hooks";
import SearchableList from "components/SearchableList"; import SearchableList from "components/SearchableList";
import { UserMap, userGetAll } from "modules/user/slice"; import { UserMap, userGetAll } from "modules/user/slice";
import UserListEntry from "modules/user/UserListEntry"; import UserListEntry from "modules/user/UserListEntry";
@ -10,7 +10,7 @@ interface Props {
} }
const UserList: FC<Props> = ({ users }) => { const UserList: FC<Props> = ({ users }) => {
const dispatch = useDispatch();
const dispatch = useAppDispatch();
const onRefresh: ReactEventHandler = (event) => { const onRefresh: ReactEventHandler = (event) => {
event.preventDefault(); event.preventDefault();


Loading…
Cancel
Save