Skip to content

Commit

Permalink
prepareSftpServerForPierUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbroman committed Sep 28, 2023
1 parent 56bb439 commit 958b444
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 40 deletions.
4 changes: 2 additions & 2 deletions hosting-holium-com/src/pages/account/custom-domain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ const CustomDomainPresenter = () => {
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/custom-domain',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/custom-domain',
});
}
Expand Down
4 changes: 2 additions & 2 deletions hosting-holium-com/src/pages/account/download-realm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ const DownloadRealmPresenter = () => {
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/download-realm',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/download-realm',
});
}
Expand Down
2 changes: 1 addition & 1 deletion hosting-holium-com/src/pages/account/get-realm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const GetRealmPresenter = () => {
const { goToPage, logout } = useNavigation();

const onClickUploadPier = () => {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/get-realm',
});
};
Expand Down
6 changes: 3 additions & 3 deletions hosting-holium-com/src/pages/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,18 @@ const HostingPresenter = () => {
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account',
});
}
};

const onClickReuploadPier = () => {
goToPage('/upload-id', {
goToPage('/upload-pier', {
product_type: 'byop-p',
back_url: '/account',
});
Expand Down
4 changes: 2 additions & 2 deletions hosting-holium-com/src/pages/account/storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const S3StoragePresenter = () => {
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/storage',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/storage',
});
}
Expand Down
4 changes: 2 additions & 2 deletions hosting-holium-com/src/pages/account/support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ const SupportPresenter = ({ alerts }: Props) => {
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/support',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/support',
});
}
Expand Down
2 changes: 1 addition & 1 deletion hosting-holium-com/src/pages/payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default function Payment({
console.error(e);
}

return goToPage('/upload-id', {
return goToPage('/upload-pier', {
product_type: 'byop-p',
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion hosting-holium-com/src/pages/upload-pier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function UploadPierPage() {
subject: 'FRONTEND: SFTP started (email notify)',
message: `Upload with SFTP started.`,
});
const response = await thirdEarthApi.uploadUploadPier(
const response = await thirdEarthApi.prepareSftpServerForPierUpload(
token,
provisionalShipId
);
Expand Down
2 changes: 1 addition & 1 deletion hosting-holium-com/src/pages/verify-email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function VerifyEmail({ product_type }: ServerSideProps) {

if (result) {
if (product_type === 'byop-p') {
return goToPage('/upload-id-disclaimer');
return goToPage('/upload-pier-disclaimer');
} else {
return goToPage('/choose-id');
}
Expand Down
28 changes: 5 additions & 23 deletions shared/src/onboarding/services/ThirdEarthApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type ProvisionalShipEntryResponse = {
invoice_id: string;
}[];

type UploadPierFileResponse = {
type PrepareSftpServerForPierUploadResponse = {
patp?: string;
sigil?: string;
arvo_key_file?: {
Expand Down Expand Up @@ -471,32 +471,14 @@ export class ThirdEarthApi {
});
}

uploadPierFile(token: string, shipId: string, formData: FormData) {
return http<UploadPierFileResponse>(
`${this.apiBaseUrl}/user/host-ship/${shipId}`,
{
method: 'POST',
headers: {
// Don't specify content-type for FormData.
authorization: `Bearer ${token}`,
client_id: this.headersClientId,
version: this.headersVersion,
},
body: formData,
},
// 60 minutes timeout
3600000
);
}

uploadUploadPier(token: string, shipId: string) {
prepareSftpServerForPierUpload(token: string, userId: string) {
const formData = new FormData();
formData.append('type', 'sftp');
formData.append('desks', 'false');
formData.append('groups', 'false');

return http<UploadPierFileResponse>(
`${this.apiBaseUrl}/user/host-ship/${shipId}`,
return http<PrepareSftpServerForPierUploadResponse>(
`${this.apiBaseUrl}/user/host-ship/${userId}`,
{
method: 'POST',
headers: {
Expand All @@ -521,7 +503,7 @@ export class ThirdEarthApi {
auditTrailCode?: number;
}
) {
return http<UploadPierFileResponse>(`${this.apiBaseUrl}/user/raise-alarm`, {
return http(`${this.apiBaseUrl}/user/raise-alarm`, {
method: 'POST',
headers: this.getHeaders(token),
body: JSON.stringify({ ...payload }),
Expand Down
4 changes: 2 additions & 2 deletions shared/src/onboarding/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ type OnboardingSignupPage =
| '/login'
| '/verify-email'
| '/choose-id'
| '/upload-id'
| '/upload-id-disclaimer'
| '/upload-pier'
| '/upload-pier-disclaimer'
| '/payment'
| '/booting'
| '/credentials'
Expand Down

0 comments on commit 958b444

Please sign in to comment.