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

Implemented: Gitbook lens search feature #24

Closed
wants to merge 11 commits into from

Conversation

amansinghbais
Copy link
Contributor

Related Issues

Closes #

Short Description and Why It's Useful

Screenshots of Visual Changes before/after (If There Are Any)

Contribution and Currently Important Rules Acceptance

@amansinghbais amansinghbais changed the title Implemented: Gitbook lens search feature [WIP] Implemented: Gitbook lens search feature Jun 7, 2024
@amansinghbais amansinghbais changed the title [WIP] Implemented: Gitbook lens search feature Implemented: Gitbook lens search feature Jun 13, 2024
@@ -1,4 +1,5 @@
import api from "@/api"
import api, {client} from "@/api"
import { hasError } from "@/utils";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused imports.

const baseURL = `https://api.gitbook.com/v1/spaces/${process.env.VUE_APP_SPACE_ID}/search/`

return await client({
url: `ask`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url: `ask`,
url: "ask"

headers: {
Authorization: 'Bearer ' + token,
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not required.

}) as any;
}

const getGitboookPage = async (pageId: any): Promise <any> => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const getGitboookPage = async (pageId: any): Promise <any> => {
const getGitBookPage = async (pageId: any): Promise <any> => {


const getGitboookPage = async (pageId: any): Promise <any> => {
const token = process.env.VUE_APP_GITBOOK_API_KEY;
const baseURL = `https://api.gitbook.com/v1/spaces/${process.env.VUE_APP_SPACE_ID}/`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep the gitbook api endpoint in the env https://api.gitbook.com/v1/spaces/

Suggested change
const baseURL = `https://api.gitbook.com/v1/spaces/${process.env.VUE_APP_SPACE_ID}/`
const baseURL = `https://api.gitbook.com/v1/spaces/${process.env.VUE_APP_SPACE_ID}/`

<ion-toolbar>
<ion-buttons slot="start">
<ion-button @click="closeModal">
<ion-icon :icon="close" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add slot icon-only

src/views/ProductStore.vue Outdated Show resolved Hide resolved
src/components/GitBookSearch.vue Outdated Show resolved Hide resolved
if (token) {

// TODO: think of better solution to avoid sending api_key for external apis.
if (token && !config.baseURL.includes("gitbook")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can check for Authorization field in the config headers, if found we will not add the api_key.
So that it will not be specific to gitbook.

@amansinghbais
Copy link
Contributor Author

Has implemented this with different approach in following PR : #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants