Your commit message

This commit is contained in:
Mo Tarbin
2025-05-27 02:58:52 -04:00
parent 6ddb8d01ec
commit 709a91b1db
11 changed files with 452 additions and 91 deletions

View File

@@ -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,

View File

@@ -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)