fix: wrong endpoints and var name

This commit is contained in:
Methapon2001 2024-06-06 14:32:59 +07:00
parent 4772a6c90b
commit fa5290dfcf

View file

@ -5,7 +5,7 @@ import { api } from 'src/boot/axios';
import { Employee, EmployeeCreate, EmployeeUpdate } from './types'; import { Employee, EmployeeCreate, EmployeeUpdate } from './types';
import axios from 'axios'; import axios from 'axios';
const useCustomerStore = defineStore('api-employee', () => { const useEmployeeStore = defineStore('api-employee', () => {
const data = ref<Pagination<Employee[]>>(); const data = ref<Pagination<Employee[]>>();
async function fetchList( async function fetchList(
opts?: { opts?: {
@ -30,7 +30,7 @@ const useCustomerStore = defineStore('api-employee', () => {
const query = params.toString(); const query = params.toString();
const res = await api.get<Pagination<Employee[]>>( const res = await api.get<Pagination<Employee[]>>(
`/customer${(params && '?'.concat(query)) || ''}`, `/employee${(params && '?'.concat(query)) || ''}`,
{ {
headers: { headers: {
'X-Session-Id': flow?.sessionId, 'X-Session-Id': flow?.sessionId,
@ -59,7 +59,7 @@ const useCustomerStore = defineStore('api-employee', () => {
const res = await api.post< const res = await api.post<
Employee & { imageUrl: string; imageUploadUrl: string } Employee & { imageUrl: string; imageUploadUrl: string }
>('/customer', payload, { >('/employee', payload, {
headers: { headers: {
'X-Session-Id': flow?.sessionId, 'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId, 'X-Rtid': flow?.refTransactionId,
@ -91,7 +91,7 @@ const useCustomerStore = defineStore('api-employee', () => {
const { image, ...payload } = data; const { image, ...payload } = data;
const res = await api.put< const res = await api.put<
Employee & { imageUrl: string; imageUploadUrl: string } Employee & { imageUrl: string; imageUploadUrl: string }
>(`/customer/${id}`, payload, { >(`/employee/${id}`, payload, {
headers: { headers: {
'X-Session-Id': flow?.sessionId, 'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId, 'X-Rtid': flow?.refTransactionId,
@ -120,7 +120,7 @@ const useCustomerStore = defineStore('api-employee', () => {
transactionId: string; transactionId: string;
}, },
) { ) {
const res = await api.delete<Employee>(`/customer/${id}`, { const res = await api.delete<Employee>(`/employee/${id}`, {
headers: { headers: {
'X-Session-Id': flow?.sessionId, 'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId, 'X-Rtid': flow?.refTransactionId,
@ -144,4 +144,4 @@ const useCustomerStore = defineStore('api-employee', () => {
}; };
}); });
export default useCustomerStore; export default useEmployeeStore;