mirror of
https://github.com/directus/directus.git
synced 2026-01-28 12:58:23 -05:00
Add accept invite
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import express from 'express';
|
||||
import argon2 from 'argon2';
|
||||
import asyncHandler from 'express-async-handler';
|
||||
import Joi from 'joi';
|
||||
import {
|
||||
|
||||
@@ -9,4 +9,8 @@ export class UsersHandler extends ItemsHandler {
|
||||
async invite(email: string | string[], role: string) {
|
||||
await this.axios.post('/users/invite', { email, role });
|
||||
}
|
||||
|
||||
async acceptInvite(token: string, password: string) {
|
||||
await this.axios.post('/users/invite/accept', { token, password });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,17 @@ describe('UsersHandler', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('acceptInvite', () => {
|
||||
it('Calls the /users/invite/accept endpoint', async () => {
|
||||
const stub = sandbox.stub(handler.axios, 'post').resolves(Promise.resolve());
|
||||
|
||||
await handler.acceptInvite('abc.def.ghi', 'p455w0rd');
|
||||
|
||||
expect(stub).to.have.been.calledWith('/users/invite/accept', {
|
||||
token: 'abc.def.ghi',
|
||||
password: 'p455w0rd',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user