|
|
@ -11,7 +11,7 @@ export const setTeamsList = (teamsList: Team[]) => {
|
|
|
|
export const addNewTeam = (newTeam: Team) => {
|
|
|
|
export const addNewTeam = (newTeam: Team) => {
|
|
|
|
return async dispatch => {
|
|
|
|
return async dispatch => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const response = await fetch('https://codefirst.iut.uca.fr/containers/enzojolys-r-dash_container/Ecuries', {
|
|
|
|
const response = await fetch('https://r-dash.azurewebsites.net/Ecuries?' + "Email=test@gmail.com" + "&password=test123" + "&pseudoPilote=test_PILOTE", {
|
|
|
|
method: 'POST',
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
'Content-Type': 'application/json'
|
|
|
@ -33,7 +33,7 @@ export const addNewTeam = (newTeam: Team) => {
|
|
|
|
export const getTeamsList = () => {
|
|
|
|
export const getTeamsList = () => {
|
|
|
|
return async dispatch => {
|
|
|
|
return async dispatch => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const teamsPromise = await fetch('https://codefirst.iut.uca.fr/containers/enzojolys-r-dash_container/Ecuries');
|
|
|
|
const teamsPromise = await fetch('https://r-dash.azurewebsites.net/Ecuries');
|
|
|
|
const teamsListJson = await teamsPromise.json();
|
|
|
|
const teamsListJson = await teamsPromise.json();
|
|
|
|
const teamsList: Team[] = teamsListJson.map(elt => new Team(elt["name"], elt["owner"], elt["users"], elt["logo"]));
|
|
|
|
const teamsList: Team[] = teamsListJson.map(elt => new Team(elt["name"], elt["owner"], elt["users"], elt["logo"]));
|
|
|
|
dispatch(setTeamsList(teamsList));
|
|
|
|
dispatch(setTeamsList(teamsList));
|
|
|
|