Files
dashboards/apps/customer/src/services/addressService.ts
T
Alireza HassaniandCursor f566387c61 Initial commit: Meshkee dashboards monorepo.
Includes business, customer, and super-admin apps with shared packages and production deploy scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-22 13:48:53 +03:30

50 lines
1.1 KiB
TypeScript

import { apiRequest } from '../lib/api'
export interface UserAddress {
id: string
label: string | null
province: string
city: string
address: string
postalCode: string | null
landline: string | null
createdAt: string
updatedAt: string
}
export interface UserAddressInput {
label?: string
province: string
city: string
address: string
postalCode?: string
landline?: string
}
export async function listAddresses(signal?: AbortSignal) {
return apiRequest<{ items: UserAddress[] }>('/auth/addresses', { auth: true, signal })
}
export async function createAddress(input: UserAddressInput) {
return apiRequest<{ address: UserAddress }>('/auth/addresses', {
method: 'POST',
auth: true,
body: input,
})
}
export async function updateAddress(addressId: string, input: UserAddressInput) {
return apiRequest<{ address: UserAddress }>(`/auth/addresses/${addressId}`, {
method: 'PATCH',
auth: true,
body: input,
})
}
export async function removeAddress(addressId: string) {
return apiRequest<{ message: string }>(`/auth/addresses/${addressId}`, {
method: 'DELETE',
auth: true,
})
}