@tsei/note
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Note

Install via npm

  • npm i -S @tsei/note

Get Started

  • git clone https://github.com/tseijp/note
  • cd note, npm i and npm start
  • open browser and visit http://localhost:3000
  • Now you can go to our demo, and try its usage.

Recipes


Component

Input Values

Return Values
Note

manage note data and api
const [note, set] = useNote(url, fetcher, config)

<Note url="..."
  fetcher={...}
  {...config}>
  {(note, set) =>
    <>{/*_*/}</>
  }
</Note>
  1. @url: string
  2. @fetcher: function
  3. @config: object
  1. @note: Note
  2. @set: function
User

manage user info and API
const [user, set] = useUser(url, fetcher, config)

<User url="..."
  fetcher={...}
  {...config}>
  {(user, set) =>
    <>{/*_*/}</>
  }
</User>
  1. @url: string
  2. @fetcher: function
  3. @config : object
  1. @user: User

    • @username : user name from fetched API e.g. tseijp
    • @authtoken: user token from cookie
    • @input : for input Components
    • @status : the acton at fetch e.g. IN, UP, OUT or ""
    • @userlang : user language from window.navigator.language e.g. ja, en
  2. @set:

    • setUser() : Toggle fetching
    • setUser(null) : switch status IN->UP or UP->IN
    • setUser(boolean): switch status '' or IN|UP|OUT

Available API

URL Description
/auth/ Distribute Auth Token
/api/ Restful Api Router
/api/note/ Note Api
key of /api/note Description
next next pagination url
previous previous pagination url
results seriaized data as array
results[0].id primary key
results[0].note_id primary key of parent
results[0].ja_text text data
results[0].en_text text data
results[0].is_author whether request user is author
results[0].posted_time time when it was posted
results[0].author_name username of posted user

Package Sidebar

Install

npm i @tsei/note

Homepage

/

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

67.7 kB

Total Files

22

Last publish

Collaborators

  • tsei