Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2917 | Rev 3262 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2917 Rev 2960
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } from 'react'
2
import { Avatar, Box, Typography } from '@mui/material'
2
import { Avatar, Typography } from '@mui/material'
Línea 3... Línea 3...
3
 
3
 
4
import { getOnRoom } from '@services/onRoom'
4
import { getOnRoom } from '@services/onRoom'
Línea 5... Línea 5...
5
import { addNotification } from '@store/notification/notification.actions'
5
import { addNotification } from '@store/notification/notification.actions'
Línea 11... Línea 11...
11
  const [loading, setLoading] = useState(false)
11
  const [loading, setLoading] = useState(false)
Línea 12... Línea 12...
12
 
12
 
13
  const handleOnRoom = async () => {
13
  const handleOnRoom = async () => {
14
    try {
14
    try {
15
      setLoading(true)
15
      setLoading(true)
16
      const response = await getOnRoom()
-
 
17
      const onRoomUrl = new URL(response.url)
-
 
18
      Object.keys(response).forEach((key) => {
-
 
19
        if (key === 'url') return
-
 
20
        onRoomUrl.searchParams.set(key, response[key])
-
 
21
      })
-
 
22
 
-
 
23
      setTimeout(() => {
16
      const onRoomUrl = await getOnRoom()
24
        window.open(onRoomUrl.toString(), '_blank')
-
 
25
      }, 0)
17
      window.open(onRoomUrl, '_blank')
26
    } catch (error) {
18
    } catch (error) {
27
      addNotification({ style: 'danger', msg: error.message })
19
      addNotification({ style: 'danger', msg: error.message })
28
    } finally {
20
    } finally {
29
      setLoading(false)
21
      setLoading(false)
30
    }
22
    }
Línea 31... Línea 23...
31
  }
23
  }
32
 
24
 
33
  return (
25
  return (
34
    <Widget>
-
 
35
      <Widget.Body styles={{ display: 'grid', placeItems: 'center' }}>
-
 
36
        {loading && (
-
 
37
          <Box
26
    <Widget>
38
            sx={{
-
 
39
              position: 'absolute',
-
 
40
              width: '100%',
-
 
41
              height: '100%',
-
 
42
              display: 'grid',
-
 
43
              placeItems: 'center',
-
 
44
              zIndex: 50
-
 
45
            }}
-
 
46
          >
-
 
47
            <Spinner />
-
 
Línea 48... Línea 27...
48
          </Box>
27
      <Widget.Body styles={{ display: 'grid', placeItems: 'center' }}>
49
        )}
28
        {loading && <Spinner absolute />}
50
 
29
 
51
        <Avatar
30
        <Avatar