diff --git a/package.json b/package.json new file mode 100644 index 0000000..96ae6e5 --- /dev/null +++ b/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/src/client.js b/src/client.js new file mode 100644 index 0000000..e37f815 --- /dev/null +++ b/src/client.js @@ -0,0 +1,33 @@ +class Client +{ + constructor(url) + { + this.token = undefined; + this.csrf_token = undefined; + this.url = url; + } + + get isAuthentificate() + { + return this.token != undefined; + } + + async _get(uri) + { + let url = this.url + uri + console.log(url) + let response; + response = await fetch(url); + return response; + } +} + +import {accounts_login} from "./urls.js" + +let url = "http://0.0.0.0:8000/" + +let client = new Client(url) + +console.log((await client._get(accounts_login))) + +export {client} \ No newline at end of file diff --git a/src/urls.js b/src/urls.js new file mode 100644 index 0000000..64f21b3 --- /dev/null +++ b/src/urls.js @@ -0,0 +1,9 @@ +let api = "api/" + +let accounts = api + "accounts/" +let accounts_register = accounts + "register" +let accounts_login = accounts + "login" +let accounts_delete = accounts + "delete" +let accounts_change_password = accounts + "change_password" + +export { accounts_login }; \ No newline at end of file