Skip to content

Commit

Permalink
added online api
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigojimenezdencker committed May 29, 2020
1 parent c0c9253 commit d5d7c1f
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/components/CRUD/Create/CreateMove/CreateMove.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class CreateType extends Component {
}

componentDidMount() {
getJSON('https://localhost:44316/api/types')
getJSON('https://pokewikiapi.azurewebsites.net/api/types')
.then(data => this.setState({ types: data }));
}

Expand All @@ -30,7 +30,7 @@ export default class CreateType extends Component {
}

addMove = () => {
postJSON('https://localhost:44316/api/moves', this.state);
postJSON('https://pokewikiapi.azurewebsites.net/api/moves', this.state);
}

handleChangeInput = event => {
Expand Down
10 changes: 5 additions & 5 deletions src/components/CRUD/Create/CreatePokemon/CreatePokemon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export default class Create extends Component {
}

componentDidMount() {
getJSON('https://localhost:44316/api/types')
getJSON('https://pokewikiapi.azurewebsites.net/api/types')
.then(data => this.setState({ types: data }));
getJSON('https://localhost:44316/api/pokemon')
getJSON('https://pokewikiapi.azurewebsites.net/api/pokemon')
.then(data => this.setState({ pokemons: data }));
}

Expand All @@ -49,7 +49,7 @@ export default class Create extends Component {
}

addPokemon = () => {
postJSON('https://localhost:44316/api/pokemon', this.state)
postJSON('https://pokewikiapi.azurewebsites.net/api/pokemon', this.state)
.then(() => this.addPrimaryType());
}

Expand All @@ -60,7 +60,7 @@ export default class Create extends Component {
subtype: false
}

postJSON('https://localhost:44316/api/typepokemon', type1)
postJSON('https://pokewikiapi.azurewebsites.net/api/typepokemon', type1)
.then(() => {
if (this.state.typeId2 !== null) this.addSecondaryType();
})
Expand All @@ -74,7 +74,7 @@ export default class Create extends Component {
subtype: true
}

postJSON('https://localhost:44316/api/typepokemon', type2);
postJSON('https://pokewikiapi.azurewebsites.net/api/typepokemon', type2);
}

handleChangeAbility = event => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CRUD/Create/CreateType/CreateType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class CreateType extends Component {
}

addType = () => {
postJSON('https://localhost:44316/api/types', this.state);
postJSON('https://pokewikiapi.azurewebsites.net/api/types', this.state);
}

handleChangeInput = event => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/CRUD/Delete/DeleteMove/DeleteMove.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export default class DeleteMove extends Component {
const { id, name } = this.props.match.params;
let moveToFetch = id ? id : name;

getJSON('https://localhost:44316/api/moves/' + moveToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/moves/' + moveToFetch)
.then(data => this.setState({ ...this.state, ...data}));
}

deleteMove = () => {
deleteJSON('https://localhost:44316/api/moves/' + this.state.moveId, this.state)
deleteJSON('https://nopuedesborrar.net/api/moves/' + this.state.moveId, this.state)
.catch(error => console.log(error))

Swal.fire({
Expand Down
4 changes: 2 additions & 2 deletions src/components/CRUD/Delete/DeletePokemon/DeletePokemon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export default class Delete extends Component {
const { id, name } = this.props.match.params;
let pokemonToFetch = id ? id : name;

getJSON('https://localhost:44316/api/pokemon/' + pokemonToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/pokemon/' + pokemonToFetch)
.then(data => this.setState({ ...this.state, ...data}));
}

deletePokemon = () => {
deleteJSON('https://localhost:44316/api/pokemon/' + this.state.pokemonId, this.state)
deleteJSON('https://nopuedesborrar.net/api/pokemon/' + this.state.pokemonId, this.state)
.catch(error => console.log(error))

Swal.fire({
Expand Down
4 changes: 2 additions & 2 deletions src/components/CRUD/Delete/DeleteType/DeleteType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export default class Delete extends Component {
const { id, name } = this.props.match.params;
let pokemonToFetch = id ? id : name;

getJSON('https://localhost:44316/api/types/' + pokemonToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/types/' + pokemonToFetch)
.then(data => this.setState({ ...this.state, ...data}));
}

deleteType = () => {
deleteJSON('https://localhost:44316/api/types/' + this.state.typeId, this.state)
deleteJSON('https://nopuedesborrar.net/api/types/' + this.state.typeId, this.state)
.catch(error => console.log(error))

Swal.fire({
Expand Down
2 changes: 1 addition & 1 deletion src/components/CRUD/List/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class List extends Component {

componentDidMount() {
const { objectName } = this.props.match.params;
getJSON('https://localhost:44316/api/' + objectName)
getJSON('https://pokewikiapi.azurewebsites.net/api/' + objectName)
.then(data => this.setState({ object: data }));
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/CRUD/Update/UpdateMove/UpdateMove.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export default class UpdateMove extends Component {
}

componentDidMount() {
getJSON('https://localhost:44316/api/types')
getJSON('https://pokewikiapi.azurewebsites.net/api/types')
.then(data => this.setState({ types: data }));

const { id, name } = this.props.match.params;
let moveToFetch = id ? id : name;

getJSON('https://localhost:44316/api/moves/' + moveToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/moves/' + moveToFetch)
.then(data => this.setState({ ...this.state, ...data}));
}

Expand All @@ -37,7 +37,7 @@ export default class UpdateMove extends Component {
}

modifyMove = () => {
putJSON('https://localhost:44316/api/moves/' + this.state.moveId, this.state)
putJSON('https://pokewikiapi.azurewebsites.net/api/moves/' + this.state.moveId, this.state)
.catch(error => error)
}

Expand Down
8 changes: 4 additions & 4 deletions src/components/CRUD/Update/UpdatePokemon/UpdatePokemon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export default class UpdatePokemon extends Component {
}

componentDidMount() {
getJSON('https://localhost:44316/api/types')
getJSON('https://pokewikiapi.azurewebsites.net/api/types')
.then(data => this.setState({ types: data }));
getJSON('https://localhost:44316/api/pokemon')
getJSON('https://pokewikiapi.azurewebsites.net/api/pokemon')
.then(data => this.setState({ pokemons: data }));

const { id, name } = this.props.match.params;
let pokemonToFetch = id ? id : name;

getJSON('https://localhost:44316/api/pokemon/' + pokemonToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/pokemon/' + pokemonToFetch)
.then(data => this.setState({ ...this.state, ...data}));
}

Expand All @@ -55,7 +55,7 @@ export default class UpdatePokemon extends Component {
}

modifyPokemon = () => {
putJSON('https://localhost:44316/api/pokemon/' + this.state.pokemonId, this.state)
putJSON('https://pokewikiapi.azurewebsites.net/api/pokemon/' + this.state.pokemonId, this.state)
.catch(error => error)
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/CRUD/Update/UpdateType/UpdateType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class UpdateType extends Component {
const { id, name } = this.props.match.params;
let typesToFetch = id ? id : name;

getJSON('https://localhost:44316/api/types/' + typesToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/types/' + typesToFetch)
.then(data => this.setState({ ...this.state, ...data}));
}

Expand All @@ -31,7 +31,7 @@ export default class UpdateType extends Component {
}

updateType = () => {
putJSON('https://localhost:44316/api/types/' + this.state.typeId, this.state)
putJSON('https://pokewikiapi.azurewebsites.net/api/types/' + this.state.typeId, this.state)
.catch(error => error);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ListPages/MovesList/MovesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class MovesList extends Component {
}

componentDidMount() {
getJSON('https://localhost:44316/api/moves')
getJSON('https://pokewikiapi.azurewebsites.net/api/moves')
.then(data => {
this.setState({ moves: data });
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/ListPages/PokemonList/PokemonList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class PokemonList extends Component {
}

componentDidMount() {
getJSON('https://localhost:44316/api/pokemon')
getJSON('https://pokewikiapi.azurewebsites.net/api/pokemon')
.then(data => {
this.setState({ pokemon: data });
setTimeout(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ListPages/TypesList/TypesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class TypesList extends Component {
}

componentDidMount() {
getJSON('https://localhost:44316/api/types')
getJSON('https://pokewikiapi.azurewebsites.net/api/types')
.then(data => {
this.setState({ types: data });
setTimeout(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/components/MovePage/MovePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class MovePage extends Component {
const { id, name } = this.props.match.params;
let movesToFetch = id ? id : name;

getJSON('https://localhost:44316/api/moves/' + movesToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/moves/' + movesToFetch)
.then(data => this.setState({ move: data }));
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/PokemonPage/PokemonPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class PokemonPage extends Component {
const { id, name } = this.props.match.params;
let pokemonToFetch = id ? id : name;

getJSON('https://localhost:44316/api/pokemon/' + pokemonToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/pokemon/' + pokemonToFetch)
.then(async data => {
this.setState({ pokemon: data });
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TypePage/TypePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class TypePage extends Component {
const { id, name } = this.props.match.params;
let typesToFetch = id ? id : name;

getJSON('https://localhost:44316/api/types/' + typesToFetch)
getJSON('https://pokewikiapi.azurewebsites.net/api/types/' + typesToFetch)
.then(data => this.setState({ type: data }));
}

Expand Down

0 comments on commit d5d7c1f

Please sign in to comment.