init
This commit is contained in:
parent
fd19180e1d
commit
a9cd640a75
3
package.json
Normal file
3
package.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
33
src/client.js
Normal file
33
src/client.js
Normal 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
9
src/urls.js
Normal 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 };
|
Loading…
Reference in New Issue
Block a user