diff --git a/client/wrap.js b/client/wrap.js index 5f9436e..fc6b93d 100644 --- a/client/wrap.js +++ b/client/wrap.js @@ -4,7 +4,7 @@ const backend_api = { 'dev': 'http://scrawny.local:3000', }[config]; -const token = localStorage.getItem('token'); +let token = localStorage.getItem('token'); async function getBandz() { const uri = `${backend_api}/bandz`; @@ -23,6 +23,16 @@ async function wrapAChikin(req) { return res.chikinId; } +async function authenticate(password) { + const uri = `${backend_api}/toktok`; + const res = await $.ajax(uri, { + type: 'POST', + contentType: 'application/json', + data: JSON.stringify({password}), + }); + return res; +} + function printLabel(chikinId) { const uri = `${backend_api}/print`; $.ajax(uri, { @@ -56,10 +66,10 @@ $(document).ready(() => { const action = $('