Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Make "params" argument optional in getter methods #836

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,9 @@ class Storyblok {

public get(
slug: string,
params?: ISbStoriesParams,
params: ISbStoriesParams = {},
fetchOptions?: ISbCustomFetch
): Promise<ISbResult> {
if (!params) params = {} as ISbStoriesParams
const url = `/${slug}`
const query = this.factoryParamOptions(url, params)

Expand All @@ -237,7 +236,7 @@ class Storyblok {

public async getAll(
slug: string,
params: ISbStoriesParams,
params: ISbStoriesParams = {},
entity?: string,
fetchOptions?: ISbCustomFetch
): Promise<any[]> {
Expand Down Expand Up @@ -270,7 +269,7 @@ class Storyblok {

public post(
slug: string,
params: ISbStoriesParams | ISbContentMangmntAPI,
params: ISbStoriesParams | ISbContentMangmntAPI = {},
fetchOptions?: ISbCustomFetch
): Promise<ISbResponseData> {
const url = `/${slug}`
Expand All @@ -280,7 +279,7 @@ class Storyblok {

public put(
slug: string,
params: ISbStoriesParams | ISbContentMangmntAPI,
params: ISbStoriesParams | ISbContentMangmntAPI = {},
fetchOptions?: ISbCustomFetch
): Promise<ISbResponseData> {
const url = `/${slug}`
Expand All @@ -290,7 +289,7 @@ class Storyblok {

public delete(
slug: string,
params: ISbStoriesParams | ISbContentMangmntAPI,
params: ISbStoriesParams | ISbContentMangmntAPI = {},
fetchOptions?: ISbCustomFetch
): Promise<ISbResponseData> {
const url = `/${slug}`
Expand All @@ -299,7 +298,7 @@ class Storyblok {
}

public getStories(
params: ISbStoriesParams,
params: ISbStoriesParams = {},
fetchOptions?: ISbCustomFetch
): Promise<ISbStories> {
this._addResolveLevel(params)
Expand All @@ -309,7 +308,7 @@ class Storyblok {

public getStory(
slug: string,
params: ISbStoryParams,
params: ISbStoryParams = {},
fetchOptions?: ISbCustomFetch
): Promise<ISbStory> {
this._addResolveLevel(params)
Expand Down
Loading