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

fixed unauthenticated user issue #62

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Fixed issue with unauthenticated B2C users in checkout shipping step

## [1.10.1] - 2023-08-17
### Fixed
- Fix conditional chain causing issue when retrieving Cost Center data
Expand Down
7 changes: 6 additions & 1 deletion checkout-ui-custom/checkout6-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,13 @@ const MAX_TIME_EXPIRATION = 1000 * 60 * 5 // 5 minutes
url: `${rootPath}/_v/private/b2b-checkout-settings/${
isWorkspace() ? `?v=${ts}` : ''
}`,
error: function(err) {
window.sessionStorage.removeItem('b2b-checkout-settings')

return
}
}).then(function (response) {
if (Object.keys(response).length === 0) {
if (Object.keys(response).length === 0 || response.error === 'User not authenticated') {
mihainutiu-vtex marked this conversation as resolved.
Show resolved Hide resolved
window.sessionStorage.removeItem('b2b-checkout-settings')

return
Expand Down
2 changes: 1 addition & 1 deletion node/resolvers/Routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
vtex: { host, logger, storeUserAuthToken, production },
} = ctx

const token: any = storeUserAuthToken

Check warning on line 13 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type

ctx.set('Content-Type', 'application/json')
ctx.set('Cache-Control', 'no-cache, no-store')
Expand All @@ -19,11 +19,11 @@
ctx.response.body = {
error: 'User not authenticated',
}
ctx.response.status = 200
ctx.response.status = 400

ctx.set('cache-control', 'no-cache')
} else {
const accountSettings: any = await vbase

Check warning on line 26 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type
.getJSON(VBASE_BUCKET, VBASE_SETTINGS_FILE, true)
.catch((error) => {
logger.error({
Expand All @@ -33,7 +33,7 @@
})

if (accountSettings?.showPONumber && !accountSettings?.hasPONumber) {
const checkoutConfig: any = await checkout

Check warning on line 36 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type
.getOrderFormConfiguration()
.catch((error) => {
logger.error({
Expand All @@ -47,7 +47,7 @@
// Check if checkout has b2b-checkout-settings app
if (
checkoutConfig?.apps.findIndex(
(currApp: any) => currApp.id === 'b2b-checkout-settings'

Check warning on line 50 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type
) === -1
) {
checkoutConfig.apps.push({
Expand All @@ -56,7 +56,7 @@
fields: ['purchaseOrderNumber'],
})

const setCheckoutConfig: any = await checkout

Check warning on line 59 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type
.setOrderFormConfiguration(checkoutConfig, ctx.vtex.authToken)
.then(() => true)
.catch((error) => {
Expand Down Expand Up @@ -85,7 +85,7 @@

const {
data: { checkUserPermission },
}: any = await graphQLServer

Check warning on line 88 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type
.query(
QUERIES.getPermission,
{},
Expand All @@ -96,7 +96,7 @@
},
}
)
.catch((error: any) => {

Check warning on line 99 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type
logger.error({
message: 'checkUserPermission-error',
error,
Expand All @@ -116,7 +116,7 @@

const userSession = await session
.getSession(sessionToken as string, ['*'])
.then((currentSession: any) => {

Check warning on line 119 in node/resolvers/Routes/index.ts

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Unexpected any. Specify a different type
return currentSession.sessionData
})
.catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3615,7 +3615,7 @@ stack-utils@^2.0.3:
dependencies:
escape-string-regexp "^2.0.0"

"stats-lite@github:vtex/node-stats-lite#dist":
stats-lite@vtex/node-stats-lite#dist:
version "2.2.0"
resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797"
dependencies:
Expand Down
Loading