Skip to content

Commit 40e70c4

Browse files
committed
Add View cart
1 parent 1fb7bce commit 40e70c4

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

src/utils/cart/api.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +0,0 @@
1-
import { getSession } from './session';
2-
import { isEmpty } from 'lodash';
3-
4-
export const getAddOrViewCartConfig = () => {
5-
6-
const config = {
7-
headers: {
8-
'X-Headless-CMS': true,
9-
},
10-
}
11-
12-
const storedSession = getSession();
13-
14-
if ( !isEmpty( storedSession ) ) {
15-
config.headers['x-wc-session'] = storedSession;
16-
}
17-
18-
return config;
19-
}

src/utils/cart/session.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +0,0 @@
1-
import { isEmpty } from 'lodash';
2-
3-
export const storeSession = ( session ) => {
4-
5-
if ( isEmpty( session ) ) {
6-
return null;
7-
}
8-
9-
localStorage.setItem( 'x-wc-session', session );
10-
}
11-
12-
export const getSession = () => {
13-
return localStorage.getItem( 'x-wc-session' );
14-
}

0 commit comments

Comments
 (0)