-
Notifications
You must be signed in to change notification settings - Fork 89
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
Feat(VTEX): Implement Session related APIs #1020
base: main
Are you sure you want to change the base?
Conversation
Tagging OptionsShould a new tag be published when this PR is merged?
|
import type { CreateEditSessionResponse } from "../../utils/openapi/vcs.openapi.gen.ts"; | ||
|
||
interface Props { | ||
publicProperties: Record<string, unknown>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change type to Record<string, { value: string }>
vtex/actions/session/editSession.ts
Outdated
import { parseCookie } from "../../utils/vtexId.ts"; | ||
|
||
interface Props { | ||
publicProperties: Record<string, unknown>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change type to Record<string, { value: string }>
vtex/loaders/session/getSession.ts
Outdated
const { vcs } = ctx; | ||
const { cookie } = parseCookie(req.headers, ctx.account); | ||
|
||
try { | ||
const response = await vcs["GET /api/sessions"]({ | ||
items: props.items.join(","), | ||
}, { | ||
headers: { cookie }, | ||
}); | ||
|
||
if (!response.ok) { | ||
throw new Error(`Failed to get session: ${response.status}`); | ||
} | ||
|
||
return await response.json(); | ||
} catch (error) { | ||
console.error("Error getting VTEX session:", error); | ||
return null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test if I can get sessions from other users
What is this Contribution About?
This PR adds a bunch of APIs related to session management, such as create, delete, edit and list