This commit is contained in:
starnakin 2023-11-06 17:57:59 +01:00
parent fd19180e1d
commit a9cd640a75
3 changed files with 45 additions and 0 deletions

3
package.json Normal file
View File

@ -0,0 +1,3 @@
{
"type": "module"
}

33
src/client.js Normal file
View File

@ -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}

9
src/urls.js Normal file
View File

@ -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 };