Skip to content

Instantly share code, notes, and snippets.

@saifulapm
Last active June 21, 2021 13:40
Show Gist options
  • Select an option

  • Save saifulapm/4c2eb84531ad68133a96b9e342a0d592 to your computer and use it in GitHub Desktop.

Select an option

Save saifulapm/4c2eb84531ad68133a96b9e342a0d592 to your computer and use it in GitHub Desktop.
var syncStore = {
action: "syncNow",
token: ''
};
function startSyncStore(callback) {
$.ajax({
type: 'POST',
url: "/sync",
dataType: 'json',
data: syncStore
}).done(function(json) {
console.log(json);
if (json.type === "success") {
if (json.token && json.token.constructor.toString().indexOf("Array") === -1) {
syncStore.token = json.token.page_info;
localStorage.setItem("page_info", json.token.page_info);
setTimeout(callback, 1000);
} else {
console.log('Completed');
}
}
});
}
(function syncNow() {
startSyncStore(syncNow);
})();
@saifulapm

Copy link
Copy Markdown
Author
  1. Search Page Filter
  2. Collection Page Filter
  3. Perfect Fit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment