From a9cd640a75095aad6a3546ef5b913f9b5d3a4ce8 Mon Sep 17 00:00:00 2001 From: starnakin Date: Mon, 6 Nov 2023 17:57:59 +0100 Subject: [PATCH] init --- package.json | 3 +++ src/client.js | 33 +++++++++++++++++++++++++++++++++ src/urls.js | 9 +++++++++ 3 files changed, 45 insertions(+) create mode 100644 package.json create mode 100644 src/client.js create mode 100644 src/urls.js 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