diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/store.js | 1 | ||||
| -rw-r--r-- | src/lib/utils.js | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/store.js b/src/lib/store.js index 4e88c90c..923bda52 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -52,3 +52,4 @@ export const request = writable(); export const requestRedirect = writable(); export const token = persistSession('token'); export const user = writable(); +export const ndef = writable(); diff --git a/src/lib/utils.js b/src/lib/utils.js index 70ea5d3b..3441556f 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -25,8 +25,8 @@ export let g = (url, fetch, headers) => } }); -export let get = (url, headers = {}) => - fetch(base + url, { headers }) +export let get = (url, headers = {}) => { + return fetch(base + url, { headers }) .then(async (r) => { if (r.ok) return r.text(); throw new Error(await r.text()); @@ -38,6 +38,7 @@ export let get = (url, headers = {}) => return body; } }); +} export let post = (url, body, headers) => { headers = { ...headers, 'content-type': 'application/json', accept: 'application/json' }; @@ -125,8 +126,8 @@ export let info = (m) => { }); }; -export let login = async (user, cookies, ip) => { - let maxAge = 30 * 24 * 60 * 60; +export let login = async (user, cookies) => { + let maxAge = 380 * 24 * 60 * 60; let res = await fetch(base + '/login', { method: 'POST', |
