stable first version

This commit is contained in:
2018-09-26 11:47:16 +02:00
parent 924e126767
commit e695b8dfb2
392 changed files with 110 additions and 65 deletions
+15
View File
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
+16 -21
View File
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from "react-redux";
import fetch from 'isomorphic-unfetch'
import api from '../../data/api'
import GriddleCustomTable from "../organisms/GriddleCustomTableComponent";
@@ -30,29 +32,22 @@ class Grid extends Component {
// this.state.pageSize
// );
var obj = {
method: 'GET' ,
//mode : 'no-cors',
headers: {
// 'Access-Control-Request-Headers': 'Authorization',
// 'Authorization': 'Basic amFzcGVyYWRtaW46amFzcGVyYWRtaW4=',
'Content-Type': 'application/json',
'Origin': ''
},
credentials: 'include'
};
// var obj = {
// method: 'GET',
// //mode : 'no-cors',
// headers: {
// // 'Access-Control-Request-Headers': 'Authorization',
// // 'Authorization': 'Basic amFzcGVyYWRtaW46amFzcGVyYWRtaW4=',
// 'Content-Type': 'application/json',
// 'Origin': ''
// },
// credentials: 'include'
// };
try {
const res = await fetch(`http://localhost/app_dev.php/api/ads?limit=10`,obj);
//console.log(res);
// if (!res.ok) {
// throw Error(res.statusText);
// }
const show = await res.json();
this.setState({ data:show.data});
} catch (error)
{
let data = await api.ads.fetchAds(10);
this.setState({ data });
} catch (error) {
console.log(error);
}
+26 -10
View File
@@ -15,22 +15,38 @@ import fetch from 'isomorphic-unfetch'
export default {
ads: {
fetchAd: async (id) =>
{
fetchAd: async (id) => {
const res = await fetch(`http://localhost/app_dev.php/api/ads/${id}`)
const offre = await res.json()
return { offre: offre.data }
},
fetchAds: async (offset,limit,order,keyword) =>
{
const url = `http://localhost/app_dev.php/api/ads`;
fetchAds: async (limit = "", order = "", keyword = "", offset = 1) => {
var obj = {
method: 'GET',
//mode : 'no-cors',
headers: {
// 'Access-Control-Request-Headers': 'Authorization',
// 'Authorization': 'Basic amFzcGVyYWRtaW46amFzcGVyYWRtaW4=',
'Content-Type': 'application/json',
'Origin': ''
},
credentials: 'include'
};
return await fetch(
)
let url = `http://localhost/app_dev.php/api/ads?offset=${offset}`;
if (limit != "") {
url = url + `&limit=${limit}`;
}
if (order != "") {
url = url + `&order=${order}`;
}
if (keyword != "") {
url = url + `&keyword=${keyword}`;
}
const res = await fetch(url, obj);
const show = await res.json();
return show.data;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More