Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
vanarok committed Jul 18, 2024
1 parent e53386a commit 83db69b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
38 changes: 16 additions & 22 deletions api.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import axios from "axios";
import axios from 'axios'

export const api = axios.create({
baseURL: localStorage.getItem('invoiceNinjaURL') || '',
headers: {
'x-api-token': localStorage.getItem('invoiceNinjaAPIToken')
}
});
})

api.interceptors.response.use((response) => {
return response.data
Expand All @@ -16,13 +16,8 @@ export const getClients = () => api.get('/clients?per_page=6&page=1?status=activ
export const getProjects = () => api.get('/projects?per_page=6&page=1?&status=active&without_deleted_clients=true&sort=budgeted_hours|desc')
export const getProject = (id: string) => api.get(`/projects/${id}`)

export const getTasks = ({clientId, projectId, taskStatusId, filter}: {
clientId?: string,
projectId: string | null,
taskStatusId?: string
filter?: string
}) => api.get(`/tasks?without_deleted_clients=true&sort=number|desc&per_page=6&page=1&client_status=uninvoiced&status=active`,
{
export const getTasks = ({clientId, projectId, taskStatusId, filter}: {clientId?: string; projectId: string | null; taskStatusId?: string; filter?: string}) =>
api.get(`/tasks?without_deleted_clients=true&sort=number|desc&per_page=6&page=1&client_status=uninvoiced&status=active`, {
params: {
project_tasks: projectId,
client_id: clientId,
Expand All @@ -31,24 +26,23 @@ export const getTasks = ({clientId, projectId, taskStatusId, filter}: {
}
})
export const getTask = (id: string) => api.get(`/tasks/${id}`)
export const putTask = (id: string, {action, data}: {
action?: string,
data?: any
}) => api.put(`/tasks/${id}`, data,
export const putTask = (
id: string,
{
action,
data
}: {
action?: string
data?: any
}
) =>
api.put(`/tasks/${id}`, data, {
params: {
...(action && {[action]: true})
}
})
export const postTask = ({description, projectId}: {
description: string,
projectId: string
}) => api.post(`/tasks`, {description, project_id: projectId})
export const postTask = ({description, projectId}: {description: string; projectId: string}) => api.post(`/tasks`, {description, project_id: projectId})
export const deleteTask = (id: string) => api.delete(`/tasks/${id}`)

export const getTaskStatuses = () => api.get('/task_statuses')
export const addTaskStatus = (data: {
name: string,
color: string,
task_status_order: number
}) => api.post('/task_statuses', data)
export const addTaskStatus = (data: {name: string; color: string; task_status_order: number}) => api.post('/task_statuses', data)
2 changes: 1 addition & 1 deletion wxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {defineConfig} from 'wxt'
import vue from '@vitejs/plugin-vue'
import unocss from 'unocss/vite'
import {defineConfig} from 'wxt'

// See https://wxt.dev/api/config.html
export default defineConfig({
Expand Down

0 comments on commit 83db69b

Please sign in to comment.