Fixed API issues and added a test file

This commit is contained in:
2024-03-11 12:19:19 +01:00
parent 6d941b7bf1
commit 6452ec2dba
10 changed files with 71 additions and 31 deletions

34
test.js Normal file
View File

@@ -0,0 +1,34 @@
import { get, post } from './modules/fetchManager';
let token = '';
async function main() {
let res = await post('http://127.0.0.1:1109/api/users/register', {
username:
'emerald',
email:
'light_emerald@aostia.com',
password:
'test1234',
first_name:
'Emerald',
last_name:
'Light',
});
console.log(res);
res = await post('http://127.0.0.1:1109/api/users/login', {
usernameOrEmail: 'emerald',
password: 'test1234',
});
console.log(res);
token = res.JSON.token;
res = await get('http://127.0.0.1:1109/api/users/email/request', token);
console.log(res);
res = await get('http://127.0.0.1:1109/api/users/email/verify?code=345708', token);
console.log(res);
}
main();