Pinafore-Web-Client-Frontend/src/routes/_api/lists.js

13 lines
501 B
JavaScript
Raw Normal View History

import { get, DEFAULT_TIMEOUT, post, WRITE_TIMEOUT } from '../_utils/ajax.js'
import { auth, basename } from './utils.js'
2018-02-08 18:15:25 +01:00
2018-02-09 07:29:29 +01:00
export function getLists (instanceName, accessToken) {
2019-08-03 22:49:37 +02:00
const url = `${basename(instanceName)}/api/v1/lists`
return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
2018-02-09 07:29:29 +01:00
}
export function createList (instanceName, accessToken, title) {
const url = `${basename(instanceName)}/api/v1/lists`
return post(url, { title }, auth(accessToken), { timeout: WRITE_TIMEOUT })
}