skelly-app
v1.0.29
Published
Utilities to integrate with Skelly
Downloads
31
Maintainers
Readme
skelly-app
Library allowing your to easily integrate your services with Skelly.
Installation
Installing the package using npm:
npm install skelly-app
Installing the repository using git and launching the demo react app:
git clone https://github.com/Skelly-gg/skelly-app.git
cd skelly-app
npm install
npm run demo
start .\dist\index.html
You can also play with the online demo.
Integration
GraphQL
Here is how you can fetch profiles using GraphQL:
import { getProfile, getProfiles } from "skelly-app";
const profile = await getProfile("N0tail");
console.log(profile)
const profiles = await getProfiles(["Keria", "12728"])
console.log(profiles)
React
You can also easily integrate profiles into your React application using our out-of-the-box component:
import {Profile} from "skelly-app";
export function App() {
const { fetchProfile, accountId, loadingProfile, profile, errorProfile } =
useFetchProfile();
React.useEffect(() => {
fetchProfile("S1mple");
}, []);
if (profile) return <Profile profile={profile} />;
else return <div>Loading profile...</div>;
}
Utilities
There are convenient utility functions available to process Skelly profiles:
import { getProfile, getAvatar, getName, getLongName } from "skelly-app";
const profile = await getProfile("N0tail");
const avatarURL = getAvatar(profile)
console.log(avatarURL)
const name = getName(profile)
console.log(name)
const longName = getLongName(profile)
console.log(longName)