diff --git a/webclient/src/App.js b/webclient/src/App.js index 504d5e4..2cdb843 100644 --- a/webclient/src/App.js +++ b/webclient/src/App.js @@ -219,7 +219,7 @@ function App() { - + diff --git a/webclient/src/Cards.js b/webclient/src/Cards.js index ce85f6f..1d1195b 100644 --- a/webclient/src/Cards.js +++ b/webclient/src/Cards.js @@ -1,12 +1,13 @@ import React, { useState, useEffect } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; import './light.css'; -import { Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; +import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; import { BasicTable, requester } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; export function Cards(props) { - const { user } = props; + const { user, token } = props; + const [open, setOpen] = useState(false); const cardStatus = (c) => c.active_status === 'card_active' ? 'Yes' : 'No'; const card = user.cards[0]; @@ -65,22 +66,66 @@ export function Cards(props) {

No cards yet! Ask a director for one after you are vetted.

} - {!!user.door_code &&
+ {!!user.door_code &&
Door Alarm Code

Only share this with vetted Protospace members:

{user.door_code}

-
} + } - {!!user.wifi_pass &&
-

+ {!!user.wifi_pass &&

Wi-Fi Password

Only share this with Protospace members and guests:

{user.wifi_pass}

-
} + } + +
API Key
+ +

Don't share this with anyone! Treat it like your password:

+ + {open ? + +

{token}

+ +
API Docs
+ +

+ To learn how to use this, refer to the API docs: +
+ + https://docs.my.protospace.ca/api.html + +

+ +
API Examples
+ +

Get your user info with Bash (curl):

+ +

$ curl -H "Authorization: Token {token}" https://api.my.protospace.ca/user/

+ +

Get your user info with Python 3 (and requests):

+ + + import json, requests
+
+ SECRET_API_KEY = '{token}'
+
+ headers = {'{'}'Authorization': 'Token '+SECRET_API_KEY{'}'}
+ r = requests.get('https://api.my.protospace.ca/user/', headers=headers)
+
+ print(json.dumps(r.json(), indent=4))
+
+
+ : +

+ +

+ } ); };