jk-services
v0.0.4
Published
A hub of common services for Jike FE.
Downloads
1
Readme
JK-Services
A hub of common services for Jike FE.
Installation
$ npm i -S jk-services
Usage
Schema usage
// Include data type definitions for services
import { MessageSchema } from 'jk-services/lib/schemas'
// Check data type based on static code analysis
const hotMessages: MessageSchema[] = [
{ ...messageItemData }
]
Request usage
// Load the category for tiny bundle
import {
request,
fileRequest
} from 'jk-services/lib/requests'
// Generic: Request
const READ_URL = 'https://example.com/api/getSth'
const readQuery = { limit: 20 }
request.get(READ_URL, readQuery)
.then(res => {
console.log(res)
})
// Spec: File request
const file = pickedFile // From imagePicker
fileRequest.uploadFile(file)
.then(res => {
const { key, url } = res
// @To do some great thing...
})