Skip to content

Commit

Permalink
LocalForageTest
Browse files Browse the repository at this point in the history
  • Loading branch information
vencax committed Aug 24, 2017
1 parent 3cf0252 commit d3ce913
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/backends/github/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ import AssetProxy from "../../valueObjects/AssetProxy";
import { SIMPLE, EDITORIAL_WORKFLOW, status } from "../../constants/publishModes";
import { APIError, EditorialWorkflowError } from "../../valueObjects/errors";

function LocalForageTest() {
const testKey = 'LocalForageTest';
LocalForage.setItem(testKey, {expires: Date.now() + 300000}).then(() => {
LocalForage.removeItem(testKey);
}).catch((err) => {
if (err.code === 22) {
const message = `Uable to set localStorage key. Quota exceeded! Full disk?`;
return alert(message);
}
console.log(err);
})
}

export default class API {
constructor(config) {
this.api_root = config.api_root || "https://api.github.com";
this.token = config.token || false;
this.branch = config.branch || "master";
this.repo = config.repo || "";
this.repoURL = `/repos/${ this.repo }`;
LocalForageTest()
}

user() {
Expand Down

0 comments on commit d3ce913

Please sign in to comment.