Your commit message
This commit is contained in:
@@ -97,12 +97,9 @@ const GetChoreDetailById = id => {
|
||||
headers: HEADERS(),
|
||||
})
|
||||
}
|
||||
const MarkChoreComplete = (id, note, completedDate, performer) => {
|
||||
const MarkChoreComplete = (id, body, completedDate, performer) => {
|
||||
var markChoreURL = `/chores/${id}/do`
|
||||
|
||||
const body = {
|
||||
note,
|
||||
}
|
||||
let completedDateFormated = ''
|
||||
if (completedDate) {
|
||||
completedDateFormated = `?completedDate=${new Date(
|
||||
@@ -220,6 +217,14 @@ const GetAllCircleMembers = async () => {
|
||||
return resp.json()
|
||||
}
|
||||
|
||||
const UpdateMemberRole = async (memberId, role) => {
|
||||
return Fetch(`/circles/members/role`, {
|
||||
method: 'PUT',
|
||||
headers: HEADERS(),
|
||||
body: JSON.stringify({ role, memberId }),
|
||||
})
|
||||
}
|
||||
|
||||
const GetUserProfile = () => {
|
||||
return Fetch(`/users/profile`, {
|
||||
method: 'GET',
|
||||
@@ -540,6 +545,7 @@ export {
|
||||
UpdateChoreStatus,
|
||||
UpdateDueDate,
|
||||
UpdateLabel,
|
||||
UpdateMemberRole,
|
||||
UpdateNotificationTarget,
|
||||
UpdatePassword,
|
||||
UpdateThingState,
|
||||
|
||||
@@ -43,6 +43,28 @@ class ApiManager {
|
||||
|
||||
export const apiManager = new ApiManager()
|
||||
|
||||
export const getAssetURL = path => {
|
||||
const baseURL = apiManager.getApiURL()
|
||||
return `${baseURL}/assets/${path}`
|
||||
}
|
||||
export async function UploadFile(url, options) {
|
||||
if (!isTokenValid()) {
|
||||
Cookies.set('ca_redirect', window.location.pathname)
|
||||
window.location.href = '/login'
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
options = {}
|
||||
}
|
||||
const headers = HEADERS()
|
||||
options.headers = { Authorization: headers['Authorization'] }
|
||||
|
||||
const baseURL = apiManager.getApiURL()
|
||||
const fullURL = `${baseURL}${url}`
|
||||
|
||||
return fetch(fullURL, options)
|
||||
}
|
||||
|
||||
export async function Fetch(url, options) {
|
||||
if (!isTokenValid()) {
|
||||
Cookies.set('ca_redirect', window.location.pathname)
|
||||
|
||||
Reference in New Issue
Block a user