Skip to content

Commit

Permalink
fix: incomaptibility of HTTP client and SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
kirinnee committed Nov 12, 2023
1 parent 0a3e39a commit caa6103
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
1 change: 1 addition & 0 deletions scripts/local/sdk_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ echo "✅ Generated SDK for Core API '$version'"
echo "🔧 Patching generated code..."
sed -i 's/import {/import type {/g' ./src/lib/api/core/Api.ts
sed -i 's/import type { ContentType, HttpClient, RequestParams/import { ContentType, HttpClient, type RequestParams/g' ./src/lib/api/core/Api.ts
sed -i '/credentials: "same-origin",/d; /headers: {},/d; /redirect: "follow",/d; /referrerPolicy: "no-referrer",/d' ./src/lib/api/core/http-client.ts
echo "✅ Patched generated code"
6 changes: 1 addition & 5 deletions src/lib/api/core/data-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export interface PluginVersionPrincipalResp {
createdAt?: string;
description?: string | null;
dockerReference?: string | null;
dockerSha?: string | null;
dockerTag?: string | null;
}

Expand Down Expand Up @@ -175,7 +174,6 @@ export interface ProcessorVersionPrincipalResp {
createdAt?: string;
description?: string | null;
dockerReference?: string | null;
dockerSha?: string | null;
dockerTag?: string | null;
}

Expand Down Expand Up @@ -263,10 +261,8 @@ export interface TemplateVersionPrincipalResp {
createdAt?: string;
description?: string | null;
blobDockerReference?: string | null;
blobDockerSha?: string | null;
templateDockerReference?: string | null;
templateDockerSha?: string | null;
blobDockerTag?: string | null;
templateDockerReference?: string | null;
templateDockerTag?: string | null;
}

Expand Down
7 changes: 1 addition & 6 deletions src/lib/api/core/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ export class HttpClient<SecurityDataType = unknown> {
private customFetch = (...fetchParams: Parameters<typeof fetch>) =>
fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
headers: {},
redirect: "follow",
referrerPolicy: "no-referrer",
};
private baseApiParams: RequestParams = {};

constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
Object.assign(this, apiConfig);
Expand Down

0 comments on commit caa6103

Please sign in to comment.