Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dellybro committed Nov 8, 2017
1 parent acbfae0 commit a1e6812
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Import the Fetch Class
import { Fetch } from '@fyresite/fetch'
Fetch.updateConfig({
"localhost": "localhost:3000"
"localhost": "localhost:3000"
})
Expand All @@ -36,17 +36,17 @@ import { fetch } from '@fyresite/fetch'
let response = await fetch('/api/v1/session/create', {
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: 'fake@gmail.com',
password: 'foobar'
})
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: 'fake@gmail.com',
password: 'foobar'
})
}).then(res => {
return res;
return res;
}).catch(err => {
console.log(err);
return {status: 501, message: `Fetch error ${err}`}
console.log(err);
return {status: 501, message: `Fetch error ${err}`}
});
```
Expand All @@ -57,10 +57,12 @@ let response = await fetch('/api/v1/session/create', {
Fetch class includes a url variable which is meant to have the key as the expected window.location.hostname,
and the value to be the API you are expecting to connect to.
```
{
'expected window.location.hostname': 'api.location.com'
'expected window.location.hostname': 'api.location.com:3000'
}
updateFetchConfig({
'expected window.location.hostname': 'api.location.com'
'expected window.location.hostname': 'api.location.com:3000'
})
```

Port of course is not necessary.

0 comments on commit a1e6812

Please sign in to comment.