feature: create POST api done.
This commit is contained in:
@@ -69,6 +69,28 @@ export default defineStore('acctMgmtStore', {
|
||||
isEditHovered: false,
|
||||
}));
|
||||
},
|
||||
/**
|
||||
* Create new user in database.
|
||||
* @param {object} userToCreate
|
||||
* userToCreate {
|
||||
* "username": "string",
|
||||
* "password": "string",
|
||||
* "name": "string",
|
||||
* "is_admin": boolean,
|
||||
* "is_active": boolean,
|
||||
* }
|
||||
*/
|
||||
async createNewAccount(userToCreate) {
|
||||
const apiCreateAccount = `/api/users`;
|
||||
|
||||
try{
|
||||
const response = await this.$axios.post(apiCreateAccount, userToCreate);
|
||||
console.log('TODO: response:', response, response.status);
|
||||
}
|
||||
catch(error) {
|
||||
apiError(error, 'Failed to add a new account');
|
||||
};
|
||||
},
|
||||
/**
|
||||
* According to mouseover or mouseleave status, change the bool value.
|
||||
* @param {string} username
|
||||
|
||||
Reference in New Issue
Block a user