sets up invite action in onboarding modal
This commit is contained in:
parent
28223baa41
commit
b3c63defb3
|
@ -17,9 +17,13 @@
|
|||
const [email, error, touched] = createValidationStore("", emailValidator)
|
||||
|
||||
async function createUserFlow() {
|
||||
const response = await users.invite(email)
|
||||
console.log(response)
|
||||
notifications.success("Email sent.")
|
||||
const res = await users.invite($email)
|
||||
console.log(res)
|
||||
if (res.status) {
|
||||
notifications.error(res.message)
|
||||
} else {
|
||||
notifications.success(res.message)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -6,22 +6,14 @@ export function createUsersStore() {
|
|||
const { subscribe, set } = writable([])
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
const response = await api.get(`/api/admin/users`)
|
||||
const json = await response.json()
|
||||
set(json)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
const response = await api.get(`/api/admin/users`)
|
||||
const json = await response.json()
|
||||
set(json)
|
||||
}
|
||||
|
||||
async function invite(email) {
|
||||
try {
|
||||
const response = await api.post(`/api/admin/users/invite`, { email })
|
||||
return await response.json()
|
||||
} catch (error) {
|
||||
return error
|
||||
}
|
||||
}
|
||||
|
||||
async function create({ email, password }) {
|
||||
|
|
Loading…
Reference in New Issue