Skip to content
Snippets Groups Projects
Commit 67f49664 authored by David Witter's avatar David Witter
Browse files

fail gracefully and create npm package

parent 38e75cc3
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,25 @@ This component is currently a work in progress, right now it does work as a stan
Right now all of the data is hardcoded in as a placeholder, this will be updated soon to use dynamic data pulled in from the MyUW session endpoint.
## Testing
## Getting Started
You can view a test of this component being used with the myuw-app-bar by opening index.html
Add the following import to your page's `<head>`:
```html
<link rel="import" href="https://unpkg.com/@myuw-web-components/myuw-profile@1.0.0/myuw-profile.html">
```
Use the component's HTML tag wherever you want:
```HTML
<myuw-profile
login-url=""
logout-url=""
session-endpoint=""
open-right=""
>
</myuw-profile>
```
#### Configurable properties
......@@ -16,4 +31,4 @@ You can view a test of this component being used with the myuw-app-bar by openin
#### Slots
- **Profile Navigation Item (nav-item):** Add a custom item to the profile button's navigation menu, this slot expects an `<a>` tag
\ No newline at end of file
- **Profile Navigation Item (nav-item):** Add a custom item to the profile button's navigation menu, this slot expects an `<a>` tag
......@@ -24,7 +24,7 @@
slot="myuw-profile"
login-url="https://wisc.edu/"
logout-url="https://wisc.edu/"
session-endpoint="http://localhost:3474/session.json"
session-endpoint="./session.json"
>
<a href="https://wisc.edu" slot="nav-item">UW Madison Home</a>
<a href="https://wisc.edu" slot="nav-item">STAR</a>
......
......@@ -203,7 +203,11 @@ class MyUWProfile extends HTMLElement {
this.componentReady();
}
})
.catch( e => console.log(e) );
.catch( e => {
console.log(e);
// Show login button if we couldn't get session info
this.componentReady();
} );
} else {
throw Error('No session endpoint has been defiend. Please set the "session-endpoint" attribute URL into the myuw-profile element!');
......
This diff is collapsed.
{
"name": "@myuw-web-components/myuw-profile",
"version": "1.0.0",
"description": "Web component that provides an avatar button and profile menu",
"main": "myuw-profile.html",
"scripts": {
"start": "superstatic --port 8080 --host 127.0.0.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/myuw-web-components/myuw-profile.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/myuw-web-components/myuw-profile/issues"
},
"homepage": "https://github.com/myuw-web-components/myuw-profile#readme",
"devDependencies": {
"superstatic": "^5.0.1"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment