mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-21 13:55:45 +00:00
refactor(FE-435,436): Use S3 public base URL for document links
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as Yup from 'yup';
|
||||
import { Expense } from '@/types/api/expense';
|
||||
import { formatDate } from '@/lib/helper';
|
||||
import { S3_PUBLIC_BASE_URL } from '@/config/constant';
|
||||
|
||||
type ExpenseRealizationFormSchemaType = {
|
||||
category?: {
|
||||
@@ -138,10 +139,13 @@ export const getExpenseRealizationFormInitialValues = (
|
||||
label: initialValues.supplier.name,
|
||||
}
|
||||
: undefined,
|
||||
existing_documents: initialValues?.realization_docs?.map((doc) => ({
|
||||
name: doc.path,
|
||||
url: doc.path,
|
||||
})),
|
||||
existing_documents: initialValues?.realization_docs?.map((doc) => {
|
||||
const path = doc.path.startsWith('/') ? doc.path.slice(1) : doc.path;
|
||||
return {
|
||||
name: doc.path,
|
||||
url: `${S3_PUBLIC_BASE_URL}/${path}`,
|
||||
};
|
||||
}),
|
||||
documents: [],
|
||||
realizations: initialValues?.kandangs
|
||||
? initialValues.kandangs.map((kandangExpense) => {
|
||||
|
||||
Reference in New Issue
Block a user