Skip to content

Commit

Permalink
Create function to add new customer
Browse files Browse the repository at this point in the history
  • Loading branch information
luis committed Apr 26, 2024
1 parent df41d5e commit 877f2bc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/api/customer/addUser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createItem } from '@directus/sdk'
import { client } from '../../api'

export async function addCustomer(data) {
const { name } = data
try {
if (!name) throw new Error('Name is required')
await client.request(createItem('customers', data))
} catch (error) {
console.error('error', error)
}
}

0 comments on commit 877f2bc

Please sign in to comment.