-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add signout and actual link to server
- Loading branch information
Showing
7 changed files
with
101 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
# graasp-compose | ||
|
||
## How to use the api | ||
|
||
- add following hosts using `sudo vim /etc/hosts` with | ||
- `127.0.01 web.graasp.org` | ||
- `128.178.242.202 api.graasp.org` | ||
- add in your `.env.local` file | ||
|
||
``` | ||
REACT_APP_API_HOST=http://api.graasp.org:3111 | ||
PORT=3111 | ||
HOST=web.graasp.org | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { API_HOST } from '../config/constants'; | ||
|
||
// payload = {email} | ||
export const getOwnItems = async () => { | ||
const req = await fetch(`${API_HOST}/own`, { | ||
method: 'GET', | ||
credentials: 'include', | ||
headers: { 'Content-Type': 'application/json' }, | ||
}); | ||
// eslint-disable-next-line no-console | ||
console.log(req); | ||
}; | ||
|
||
// payload = {email} | ||
export const createItem = async () => { | ||
const req = await fetch(`${API_HOST}/items`, { | ||
method: 'POST', | ||
credentials: 'include', | ||
body: JSON.stringify({ name: 'myitem' }), | ||
headers: { 'Content-Type': 'application/json' }, | ||
}); | ||
// eslint-disable-next-line no-console | ||
console.log(await req.json()); | ||
}; | ||
|
||
// we need this function for navigation purposes: when you click on an item, you want to see its 'immediate' children | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const fetchItemImmediateChildren = () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Cookies from 'js-cookie'; | ||
|
||
// could use redux store to keep session | ||
// todo: better check on session | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const isSignedIn = () => { | ||
const value = Cookies.get('session'); | ||
return Boolean(value); | ||
}; |