authera 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web/login.js CHANGED
@@ -10,14 +10,14 @@ export default function LoginForm() {
10
10
  const [activeStep, activeStepHandler] = useState();
11
11
  const [loading, loadingHandler] = useState(true);
12
12
  const { handleSubmit, control } = useForm();
13
- const { go_after_login_url, backendUrl } = useAuth();
13
+ const { go_after_login_url, backendUrl, setUserData } = useAuth();
14
14
  const request = axios.create({
15
15
  baseURL: backendUrl,
16
16
  });
17
17
  // fetch data from steps
18
18
  useEffect(() => {
19
19
  async function fetchSteps() {
20
- const response = await request.get("validate/options");
20
+ const response = await request.get("options");
21
21
  const data = Object.entries(response.data).map(([opt, schema]) => ({
22
22
  name: opt,
23
23
  structure: convertFromSchema(schema),
@@ -29,7 +29,7 @@ export default function LoginForm() {
29
29
  fetchSteps();
30
30
  }, []);
31
31
  const onSubmit = async (data) => {
32
- const response = await request.post(activeStep.name, data);
32
+ const response = await request.post("validate/" + activeStep.name, data);
33
33
  // if response say go next step
34
34
  if (response.status === 202) {
35
35
  const nextIndex = (steps?.findIndex((d) => d.name === activeStep?.name) || 0) + 1;
@@ -38,6 +38,7 @@ export default function LoginForm() {
38
38
  // if response say authenticate is finished
39
39
  else if (response.status === 200) {
40
40
  window.location.href = go_after_login_url;
41
+ setUserData(response.data);
41
42
  }
42
43
  // if response say have a wrong in this request
43
44
  else if (response.status === 400) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authera",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "this project is a simple auth hook for react",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",