Skip to content
Yos666666 edited this page Oct 7, 2022 · 5 revisions

/src/api/user/index.js

Functions

Retrieves a user's data according to their ID

getUser(userID)
  • slug - string : User ID
Example
import { getUser } from '@aquilacms/aquila-connector/api/user';
user = await getUser('userId');

Updates a user's data

setUser(user)
  • user - any : Object containing the data
Example
import { setUser } from '@aquilacms/aquila-connector/api/user';
user = await setUser(data);

Updates a user's addresses

setAddressesUser(userId, billingAddress, deliveryAddress, addresses)
  • userId - string : User ID
  • billingAddress - int : Billing address index
  • deliveryAddress - int : Delivery address index
  • addresses - any : addresses
Example
import { SetAddressesUser } from '@aquilacms/aquila-connector/api/user';
userAdress = await SetAddressesUser('userId', 0, 1, adresses);

Resets a user's password

resetPassword(token, password)
  • token - string : Reset Token
  • password - string : New Password
Example
import { resetPassword } from '@aquilacms/aquila-connector/api/user';
userPassword = await resetPassword(token, password);

Activate a user account

validateAccount(token)
  • token - string : Activation token
Example
import { validateAccount } from '@aquilacms/aquila-connector/api/user';
const newUser = await validateAccount(token);

Exports all of a user's data in JSON format to a txt file

dataUserExport(userId)
  • userId - string : User ID
Example
import { dataUserExport } from '@aquilacms/aquila-connector/api/user';
const response = await dataUserExport('userId');

Anonymizes a user's data

anonymizeUser(userId)
  • userId - string : User ID
Example
import { anonymizeUser } from '@aquilacms/aquila-connector/api/user';
const namelessUser = await anonymizeUser('userId');

Deletes a user's account

deleteUser(userId)
Example
import { deleteUser} from '@aquilacms/aquila-connector/api/user';
const deletAccount = await deleteUser('userId');
  • userId - string : User ID
Clone this wiki locally