Commit 597e73bf authored by Vincent Seyller's avatar Vincent Seyller
Browse files

Comment

parent 3d9bf45a
......@@ -8,6 +8,9 @@ let checkStatus = (res) => {
}
};
/**
* File to communicate with JPA API
*/
const API = {
alreadyVoted: (data) => {
return fetch(`${ApiURL}/colocation/${data.idColoc}/services/${data.idService}/alreadyVoted`, {
......
......@@ -2,10 +2,13 @@ import {useQuery, useQueryCache} from 'react-query';
import {useParams, useHistory} from 'react-router-dom';
import {ListGroup, Container, Button} from 'react-bootstrap';
import {Typography} from '@material-ui/core/'
import {useEffect, useState} from 'react';
import {useEffect} from 'react';
import API from './API';
/**
* Show every achieved service done
*/
let AchievedServices = () => {
const queryCache = useQueryCache();
......
......@@ -6,6 +6,9 @@ import {ListGroup, Button, Container, Card} from 'react-bootstrap';
import API from './API'
/**
* Show every colocations of user
*/
let Colocations = () => {
const queryCache = useQueryCache();
......
......@@ -6,6 +6,9 @@ import {useState, useEffect} from 'react';
import API from './API';
/**
* Show every members of colocation
*/
let Details = () => {
const queryCache = useQueryCache();
......
import {useState} from 'react';
import {Button, TextField, Typography} from '@material-ui/core/'
/**
* Edit user profile
*/
let Edit = ({edit}) => {
let user = JSON.parse(window.localStorage.getItem('user'));
......
import {useQuery, useMutation, useQueryCache} from 'react-query';
import {useParams, useHistory} from 'react-router-dom';
import {ListGroup, Container, Button, Modal} from 'react-bootstrap';
import {Container, Button, Modal} from 'react-bootstrap';
import {TextField} from '@material-ui/core/'
import {useEffect, useState} from 'react';
import PerfectScrollbar from 'react-perfect-scrollbar'
import {useState} from 'react';
import API from './API';
/**
* Show messages of colocation
*/
let Messages = () => {
const queryCache = useQueryCache();
......
......@@ -6,6 +6,9 @@ import {useEffect, useState} from 'react';
import API from './API';
/**
* Show services not voted by user (not working)
*/
let RequestedServices = () => {
const queryCache = useQueryCache();
......@@ -28,8 +31,8 @@ let RequestedServices = () => {
{status === 'success' && (
<>
<ListGroup>
{data.map((service, idx) => {
return <ListGroup.Item key={idx}><Service service={service} /></ListGroup.Item>
{data.map((requestedService, idx) => {
return <ListGroup.Item key={idx}><RequestedService requestedService={requestedService} /></ListGroup.Item>
})}
</ListGroup>
</>
......@@ -39,14 +42,14 @@ let RequestedServices = () => {
</Container>;
}
let RequestedService = ({service}) => {
let RequestedService = ({requestedService}) => {
let [vote, setVote] = useState(null);
let id = parseInt(useParams().id);
useEffect(() => {
API.alreadyVoted({idColoc: id, idService: requestedService.id})
.then(data => setVote(data));
}, [id, service.id]);
}, [id, requestedService.id]);
return <>
<Typography variant="h6" color="primary">{requestedService.service.title}</Typography>
......
......@@ -2,10 +2,13 @@ import {useQuery, useQueryCache} from 'react-query';
import {useParams, useHistory} from 'react-router-dom';
import {ListGroup, Container, Button} from 'react-bootstrap';
import {Typography} from '@material-ui/core/'
import {useEffect, useState} from 'react';
import {useEffect} from 'react';
import API from './API';
/**
* Show all services of colocation
*/
let Services = () => {
const queryCache = useQueryCache();
......
......@@ -22,6 +22,9 @@ import Edit from './Edit'
import Messages from './Messages'
import RequestedServices from './RequestedServices';
/**
* Home file
*/
let useStyles = makeStyles((theme) => ({
root: {
flexGrow: 1,
......
import {useState} from 'react';
import {Button, TextField, Typography} from '@material-ui/core/'
/**
* User signin
*/
let Signin = ({signin}) => {
let [email, setEmail] = useState('');
let [password, setPassword] = useState('');
......
import {useState} from 'react';
import {Button, TextField, Typography} from '@material-ui/core/'
/**
* User signup
*/
let Signup = ({signup}) => {
let [email, setEmail] = useState('');
let [firstName, setFirstName] = useState('');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment