Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mkotsollaris committed Jan 28, 2021
1 parent 0c1f2e0 commit afa40e1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion readme_assets/DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ Last but not least, copy the snippet of code generated from the facet-extension.
(//todo image)

This will give you the single line that you need to paste into your `<head>` HTML code. The line looks like this:
`<script src="https://api.facet.ninja/facet.ninja.js?id={ID}"></script>`
`<script src="https://api.facet.run/js?id={ID}"></script>`

The ID refers to the ID of your website. Once this line of code is integrated in your system, you will be able to see the configurations applied from the facet extension.
13 changes: 4 additions & 9 deletions src/AppProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const AppProvider = ({ children }) => {
const [addedFacets, setAddedFacets] = useState(['Default-Facet']);
const [canDeleteElement, setCanDeleteElement] = useState(false);
const [disabledFacets, setDisabledFacets] = useState([]);
const [textToCopy, setTextToCopy] = useState(`<script src="${APIUrl.apiBaseURL}/facet.ninja.js?id={ID}"></script>`);
const [textToCopy, setTextToCopy] = useState(`<script src="${APIUrl.apiBaseURL}/js?id={ID}"></script>`);

const [expanded, setExpanded] = useState([]);
const [facetMap, setFacetMap] = useFacetMap();
Expand Down Expand Up @@ -145,11 +145,6 @@ const AppProvider = ({ children }) => {
});
}

// TODO is this needed?
const onLoginClick = (val) => {
// setLoading(val);
}

const loadJWT = async () => {
const jwt = await AmplifyService.getCurrentUserJTW();
if (jwt) {
Expand All @@ -172,7 +167,7 @@ const AppProvider = ({ children }) => {
try {
const workspaceId = await getKeyFromLocalStorage(api.workspace.workspaceId);
const domainRes = await getOrPostDomain(workspaceId);
const text = `<script src="${APIUrl.apiBaseURL}/facet.ninja.js?id=${domainRes.response.id}"></script>`;
const text = `<script src="${APIUrl.apiBaseURL}/js?id=${domainRes.response.id}"></script>`;
setTextToCopy(text);
} catch (e) {
console.log('[ERROR][loadCopySnippet]', e);
Expand All @@ -182,7 +177,7 @@ const AppProvider = ({ children }) => {
const getJSUrl = async () => {
const workspaceId = await getKeyFromLocalStorage(api.workspace.workspaceId);
const domainRes = await getOrPostDomain(workspaceId);
const result = `${APIUrl.apiBaseURL}/facet.ninja.js?id=${domainRes.response.id}`;
const result = `${APIUrl.apiBaseURL}/js?id=${domainRes.response.id}`;
setJSUrl(result);
}

Expand Down Expand Up @@ -399,7 +394,7 @@ const AppProvider = ({ children }) => {
jsUrl,

loggedInUser, setLoggedInUser, url, setUrl, login, isUserAuthenticated, setIsUserAuthenticated,
workspaceId, email, setEmail, loading, setLoading, onLoginClick,
workspaceId, email, setEmail, loading, setLoading,
currAuthState, setCurrAuthState, jwt, setJwt, nonRolledOutFacets, setNonRolledOutFacets
}}
>
Expand Down
6 changes: 1 addition & 5 deletions src/popup/PopupProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ export default ({ children }) => {
triggerDOMReload();
}

const onLoginClick = (val) => {
// setLoading(val);
}

const loadJWT = async () => {
const jwt = await AmplifyService.getCurrentUserJTW();
setJwt(jwt);
Expand All @@ -58,7 +54,7 @@ export default ({ children }) => {
return <PopupContext.Provider value={{
loggedInUser, setLoggedInUser, url, setUrl, isPluginEnabled,
setIsPluginEnabled, login, isUserAuthenticated, setIsUserAuthenticated,
workspaceId, email, setEmail, loading, setLoading, onLoginClick,
workspaceId, email, setEmail, loading, setLoading,
currAuthState, setCurrAuthState, jwt, setJwt
}}>
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/shared/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const facetizerId = 'facetizer';
const facetKey = 'facet-settings'
const isPluginEnabled = 'isPluginEnabled';
const isUserAuthenticated = 'isUserAuthenticated';
const apiBaseURL = 'https://api.facet.ninja';
const testBaseURL = 'https://test.api.facet.ninja';
const apiBaseURL = 'https://api.facet.run';
const testBaseURL = 'https://test.api.facet.run';
const localBaseURL = 'http://localhost:3002';

const authState = {
Expand Down

0 comments on commit afa40e1

Please sign in to comment.