-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce3c25e
commit 7785518
Showing
6 changed files
with
13 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,7 +238,7 @@ async function main() { | |
id: '339cf78e-d13f-4069-b1f7-dee0c64afb31', | ||
firstName: 'Kai', | ||
lastName: 'Zheng', | ||
email: '[email protected]', | ||
email: '[email protected]', | ||
positionId: CHIEF_FIN_OFFICER_UUID, | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,27 @@ | ||
import { FormInstanceEntity, FormTemplateEntity } from '@web/client'; | ||
import { useEffect, useState } from 'react'; | ||
import { mockStorage } from './../services/storage.service'; | ||
import { storage } from './../services/storage.service'; | ||
|
||
// hook to fetch form blob from storage | ||
export const useStorage = ( | ||
form: FormInstanceEntity | FormTemplateEntity | null, | ||
) => { | ||
const [formBlob, setFormBlob] = useState<Blob | null>(null); | ||
const [mockBlob, setMockBlob] = useState<Blob | null>(null); | ||
|
||
// This needs to be uncommented once storage is set up | ||
// useEffect(() => { | ||
// async function fetchFormBlob() { | ||
// const blob = (await storage.downloadBlob(form?.formDocLink!)) as Blob; | ||
// const arrayBuffer = await blob.arrayBuffer(); | ||
// setFormBlob(new Blob([arrayBuffer], { type: 'application/pdf' })); | ||
// } | ||
|
||
// async function fetchMockBlob() {} | ||
|
||
// if (form) { | ||
// fetchFormBlob(); | ||
// } | ||
// }, [form]); | ||
|
||
useEffect(() => { | ||
async function fetchMockBlob() { | ||
const blob = (await mockStorage.downloadBlob('mockBlobLink')) as Blob; | ||
async function fetchFormBlob() { | ||
const blob = (await storage.downloadBlob(form?.formDocLink!)) as Blob; | ||
const arrayBuffer = await blob.arrayBuffer(); | ||
setMockBlob(new Blob([arrayBuffer], { type: 'application/pdf' })); | ||
setFormBlob(new Blob([arrayBuffer], { type: 'application/pdf' })); | ||
} | ||
|
||
fetchMockBlob(); | ||
if (form) { | ||
fetchFormBlob(); | ||
} | ||
}, [form]); | ||
|
||
return { | ||
formBlob, | ||
mockBlob, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters