Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140705

Add AntD success message as a step in the firebase authentication process handler

$
0
0

I am trying to figure out how to add an Ant Design message as a step in the firebase user authentication (sign up) and database creation for user document steps process.

The AntD documentation shows how to use an onClick step to generate a message.

<Button onClick={success}>Success</Button>

I'm trying to figure out how to write .then and have that be the message activation.

I can see that the Ant Design documentation has instructions for how to make an object with a message and I'm trying to figure out how to add another object to by on submit handler in the firebase sign up process.

Currently - the on submit handler has:

handleCreate = (event) => {
    const { form } = this.formRef.props;
    form.validateFields((err, values) => {
      if (err) {
        return;
      };
    const payload = {
    name: values.name,
    email: values.email,
    // createdAt: this.fieldValue.Timestamp()
    createdAt: this.props.firebase.fieldValue.serverTimestamp()

    }
    console.log("formvalues", payload);
    // console.log(_firebase.fieldValue.serverTimestamp());


    this.props.firebase
    .doCreateUserWithEmailAndPassword(values.email, values.password)
    .then(authUser => {
    return this.props.firebase.user(authUser.user.uid).set(
        {
          name: values.name,
          email: values.email,
          //createdAt: this.props.firebase.fieldValue.serverTimestamp()

        },
        { merge: true },
    );
    // console.log(this.props.firebase.fieldValue.serverTimestamp())
    })
    .then(() => {
      return this.props.firebase.doSendEmailVerification();
      })
    // .then(() => {message.success("Success") })
    .then(() => {
      this.setState({ ...initialValues });
      this.props.history.push(ROUTES.DASHBOARD);

    })

    this.setState({ visible: false });

  });
  event.preventDefault();
    };

My attempt at making a message object is shown in comment above and below.

// .then(() => {message.success("Success") })

It doesn't generate an error message, but it also doesn't work. It just gets skipped over as a step in the process.

Can anyone see how to add a message to the process? I don't have a button to use to initiate an onClick starting point to use the message.


Viewing all articles
Browse latest Browse all 140705

Latest Images

Trending Articles



Latest Images