1 |
37f6ff02
|
Vaclav Honzik
|
import { createAsyncThunk } from '@reduxjs/toolkit'
|
2 |
|
|
import axiosInstance from '../../api/api'
|
3 |
|
|
import { UserDto } from '../../swagger/data-contracts'
|
4 |
|
|
|
5 |
|
|
export interface RegisterUser {
|
6 |
|
|
username: string
|
7 |
|
|
email: string
|
8 |
|
|
password: string
|
9 |
|
|
passwordRepeat: string
|
10 |
|
|
}
|
11 |
|
|
export const registerUser = createAsyncThunk(
|
12 |
|
|
'users/register',
|
13 |
|
|
async (registerUser: UserDto) => {
|
14 |
|
|
try {
|
15 |
|
|
const { data } = await axiosInstance.post(
|
16 |
|
|
'/users/register',
|
17 |
|
|
registerUser
|
18 |
|
|
)
|
19 |
|
|
} catch (error: any) {
|
20 |
|
|
|
21 |
|
|
}
|
22 |
|
|
}
|
23 |
|
|
)
|