Fixed API issues and added a test file
This commit is contained in:
34
test.js
Normal file
34
test.js
Normal 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();
|
||||
Reference in New Issue
Block a user