1+ "use server" ;
12import {
23 ConfirmDocumentUploadRequest ,
34 ConfirmDocumentUploadResponse ,
@@ -16,7 +17,7 @@ import {
1617 UploadClaimRelatedDocumentsRequest ,
1718 UploadClaimRelatedDocumentsResponse ,
1819} from "@/types/claim" ;
19- import { authHeader , clientAuthWrapper , getClient } from "./client" ;
20+ import { authHeader , authWrapper , getClient } from "./client" ;
2021
2122export const createClaim = async ( payload : CreateClaimRequest ) : Promise < CreateClaimResponse > => {
2223 const req = async ( token : string ) : Promise < CreateClaimResponse > => {
@@ -31,7 +32,7 @@ export const createClaim = async (payload: CreateClaimRequest): Promise<CreateCl
3132 throw Error ( error ?. error ) ;
3233 }
3334 } ;
34- return clientAuthWrapper < CreateClaimResponse > ( ) ( req ) ;
35+ return authWrapper < CreateClaimResponse > ( ) ( req ) ;
3536} ;
3637
3738export const getClaims = async ( input : GetCompanyClaimRequest ) : Promise < GetCompanyClaimResponse > => {
@@ -47,7 +48,7 @@ export const getClaims = async (input: GetCompanyClaimRequest): Promise<GetCompa
4748 throw Error ( error ?. error ) ;
4849 }
4950 } ;
50- return clientAuthWrapper < GetCompanyClaimResponse > ( ) ( req ) ;
51+ return authWrapper < GetCompanyClaimResponse > ( ) ( req ) ;
5152} ;
5253
5354export const getPurchaseLineItemsFromClaim = async ( params : {
@@ -71,7 +72,7 @@ export const getPurchaseLineItemsFromClaim = async (params: {
7172 throw Error ( error ?. error ) ;
7273 }
7374 } ;
74- return clientAuthWrapper < GetClaimLineItemsResponse > ( ) ( req ) ;
75+ return authWrapper < GetClaimLineItemsResponse > ( ) ( req ) ;
7576} ;
7677
7778export const getClaimById = async ( claimId : string ) : Promise < GetClaimByIdResponse > => {
@@ -89,7 +90,7 @@ export const getClaimById = async (claimId: string): Promise<GetClaimByIdRespons
8990 throw Error ( error ?. error ) ;
9091 }
9192 } ;
92- return clientAuthWrapper < GetClaimByIdResponse > ( ) ( req ) ;
93+ return authWrapper < GetClaimByIdResponse > ( ) ( req ) ;
9394} ;
9495
9596export const updateClaimStatus = async (
@@ -111,7 +112,7 @@ export const updateClaimStatus = async (
111112 throw Error ( error ?. error ) ;
112113 }
113114 } ;
114- return clientAuthWrapper < UpdateClaimStatusResponse > ( ) ( req ) ;
115+ return authWrapper < UpdateClaimStatusResponse > ( ) ( req ) ;
115116} ;
116117
117118export const uploadAndConfirmDocumentRelation = async (
@@ -157,7 +158,7 @@ export const uploadClaimRelatedDocuments = async (
157158 throw Error ( error ?. error ) ;
158159 }
159160 } ;
160- return clientAuthWrapper < UploadClaimRelatedDocumentsResponse > ( ) ( req ) ;
161+ return authWrapper < UploadClaimRelatedDocumentsResponse > ( ) ( req ) ;
161162} ;
162163
163164export const conformUploadedDocument = async (
@@ -176,7 +177,7 @@ export const conformUploadedDocument = async (
176177 throw Error ( error ?. error ) ;
177178 }
178179 } ;
179- return clientAuthWrapper < ConfirmDocumentUploadResponse > ( ) ( req ) ;
180+ return authWrapper < ConfirmDocumentUploadResponse > ( ) ( req ) ;
180181} ;
181182
182183export const linkLineItemToClaim = async ( claimId : string , purchaseLineItemId : string ) => {
@@ -192,7 +193,7 @@ export const linkLineItemToClaim = async (claimId: string, purchaseLineItemId: s
192193 throw Error ( error ?. error ) ;
193194 }
194195 } ;
195- return clientAuthWrapper < LinkLineItemToClaimResponse > ( ) ( req ) ;
196+ return authWrapper < LinkLineItemToClaimResponse > ( ) ( req ) ;
196197} ;
197198
198199export const linkPurchaseToClaim = async ( claimId : string , purchaseId : string ) => {
@@ -208,7 +209,7 @@ export const linkPurchaseToClaim = async (claimId: string, purchaseId: string) =
208209 throw Error ( error ?. error ) ;
209210 }
210211 } ;
211- return clientAuthWrapper < LinkPurchaseToClaimResponse > ( ) ( req ) ;
212+ return authWrapper < LinkPurchaseToClaimResponse > ( ) ( req ) ;
212213} ;
213214
214215export const createClaimPDF = async ( claimId : string ) => {
@@ -226,7 +227,7 @@ export const createClaimPDF = async (claimId: string) => {
226227 throw Error ( error ?. error ) ;
227228 }
228229 } ;
229- return clientAuthWrapper < CreateClaimPDFResponse > ( ) ( req ) ;
230+ return authWrapper < CreateClaimPDFResponse > ( ) ( req ) ;
230231} ;
231232
232233export const deleteClaim = async ( claimId : string ) => {
@@ -244,5 +245,5 @@ export const deleteClaim = async (claimId: string) => {
244245 throw Error ( error ?. error ) ;
245246 }
246247 } ;
247- return clientAuthWrapper < DeleteClaimResponse > ( ) ( req ) ;
248+ return authWrapper < DeleteClaimResponse > ( ) ( req ) ;
248249} ;
0 commit comments