Fix types
This commit is contained in:
		
					parent
					
						
							
								004160b664
							
						
					
				
			
			
				commit
				
					
						81771f511c
					
				
			
		
					 5 changed files with 8 additions and 6 deletions
				
			
		| 
						 | 
					@ -148,7 +148,7 @@ export const ClientProvider: FC<Props> = ({ children }) => {
 | 
				
			||||||
                  },
 | 
					                  },
 | 
				
			||||||
                  false // Don't need the crypto store just to log out
 | 
					                  false // Don't need the crypto store just to log out
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                await client.logout(undefined, true);
 | 
					                await client.logout(true);
 | 
				
			||||||
              } catch (err_) {
 | 
					              } catch (err_) {
 | 
				
			||||||
                logger.warn(
 | 
					                logger.warn(
 | 
				
			||||||
                  "The previous session was lost, and we couldn't log it out, " +
 | 
					                  "The previous session was lost, and we couldn't log it out, " +
 | 
				
			||||||
| 
						 | 
					@ -255,7 +255,7 @@ export const ClientProvider: FC<Props> = ({ children }) => {
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const logout = useCallback(async () => {
 | 
					  const logout = useCallback(async () => {
 | 
				
			||||||
    await client.logout(undefined, true);
 | 
					    await client.logout(true);
 | 
				
			||||||
    await client.clearStores();
 | 
					    await client.clearStores();
 | 
				
			||||||
    clearSession();
 | 
					    clearSession();
 | 
				
			||||||
    setState({
 | 
					    setState({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,7 @@ export const useInteractiveLogin = () =>
 | 
				
			||||||
      password: string
 | 
					      password: string
 | 
				
			||||||
    ) => Promise<[MatrixClient, Session]>
 | 
					    ) => Promise<[MatrixClient, Session]>
 | 
				
			||||||
  >(async (homeserver: string, username: string, password: string) => {
 | 
					  >(async (homeserver: string, username: string, password: string) => {
 | 
				
			||||||
    const authClient = createClient(homeserver);
 | 
					    const authClient = createClient({ baseUrl: homeserver });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const interactiveAuth = new InteractiveAuth({
 | 
					    const interactiveAuth = new InteractiveAuth({
 | 
				
			||||||
      matrixClient: authClient,
 | 
					      matrixClient: authClient,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ export const useInteractiveRegistration = (): [
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const authClient = useRef<MatrixClient>();
 | 
					  const authClient = useRef<MatrixClient>();
 | 
				
			||||||
  if (!authClient.current) {
 | 
					  if (!authClient.current) {
 | 
				
			||||||
    authClient.current = createClient(defaultHomeserver);
 | 
					    authClient.current = createClient({ baseUrl: defaultHomeserver });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,9 @@ export function useProfile(client: MatrixClient) {
 | 
				
			||||||
          if (removeAvatar) {
 | 
					          if (removeAvatar) {
 | 
				
			||||||
            await client.setAvatarUrl("");
 | 
					            await client.setAvatarUrl("");
 | 
				
			||||||
          } else if (avatar) {
 | 
					          } else if (avatar) {
 | 
				
			||||||
            mxcAvatarUrl = await client.uploadContent(avatar);
 | 
					            ({ content_uri: mxcAvatarUrl } = await client.uploadContent(
 | 
				
			||||||
 | 
					              avatar
 | 
				
			||||||
 | 
					            ));
 | 
				
			||||||
            await client.setAvatarUrl(mxcAvatarUrl);
 | 
					            await client.setAvatarUrl(mxcAvatarUrl);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ function isIOS() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function usePageUnload(callback: () => void) {
 | 
					export function usePageUnload(callback: () => void) {
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    let pageVisibilityTimeout: number;
 | 
					    let pageVisibilityTimeout: ReturnType<typeof setTimeout>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function onBeforeUnload(event: PageTransitionEvent) {
 | 
					    function onBeforeUnload(event: PageTransitionEvent) {
 | 
				
			||||||
      if (event.type === "visibilitychange") {
 | 
					      if (event.type === "visibilitychange") {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue