An open API service indexing awesome lists of open source software.

https://github.com/sohanemon/diagnostic-center-client


https://github.com/sohanemon/diagnostic-center-client

practice swiper

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

## Get data from Form

```js
const data = ["name", "photoURL", "email", "password"].map(
(el) => e.target[el].value
); //['sfj','sfa','sfa','dfa']
```

or a better way

```js
let data = {}; // its important
["email", "password"].forEach((el) => (data[el] = e.target[el].value)); // {email: 'efj', password: 'sse'}
```

## To align something with margin (mx-auto, ml-auto, mr-auto)

- set them as block element

```js

```

## Promise based toast/react-hot-toast

- syntax

```js
toast.promise(promise, {
/*configs*/
});
```

- example

```js
const promise = client.post("/service", data);
toast.promise(promise, {
loading: "loading",
success: "added successfully",
error: "something went wrong",
});
```

- and also further `.then` can be added

```js
toast
.promise(client.post("/service", data), {
// ...
})
.then(() => {
e.target.reset();
navigate("/");
});
```