Last change
on this file since 0f5aa27 was 0f5aa27, checked in by darsov2 <62809499+darsov2@…>, 8 months ago |
ouath, mailing impl
|
-
Property mode
set to
100644
|
File size:
618 bytes
|
Rev | Line | |
---|
[e6c2521] | 1 | import React from "react";
|
---|
| 2 | import axios from "../../../axios.js";
|
---|
| 3 | import { useHistory, useNavigate } from 'react-router-dom';
|
---|
| 4 |
|
---|
| 5 | const useCreateUser = () => {
|
---|
| 6 |
|
---|
| 7 | const navigator = useNavigate()
|
---|
| 8 | const createUser = async (user) => {
|
---|
| 9 | await axios
|
---|
| 10 | .post(`/register`, user)
|
---|
| 11 | .then((res) => {
|
---|
[0f5aa27] | 12 | window.location.href = "http://localhost:8080/login"
|
---|
[e6c2521] | 13 | })
|
---|
| 14 | .catch((err) => {
|
---|
| 15 | console.log(err);
|
---|
| 16 | })
|
---|
| 17 | .finally(() => {
|
---|
| 18 | });
|
---|
| 19 | }
|
---|
| 20 | return {
|
---|
| 21 | createUser
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | export default useCreateUser; |
---|
Note:
See
TracBrowser
for help on using the repository browser.