Skip to content

Update docs to match the new package name #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Marcelo Lauxen
Copyright (c) 2021 Basecamp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Rails Fetch
# Request.JS

Rails Fetch encapsulates the logic to send by default some headers that are required by rails applications like the `X-CSRF-Token`.
Request.JS encapsulates the logic to send by default some headers that are required by rails applications like the `X-CSRF-Token`.

# Install

### npm
```
npm i rails-fetch
npm i @rails/request.js
```
### yarn
```shell
yarn add rails-fetch
yarn add @rails/request.js
```

# How to use
Expand All @@ -20,12 +20,12 @@ Just import the `Request` class from the package and instantiate it passing the
Example:

```js
import { Request } from 'rails-fetch'
import { Request } from '@rails/request.js'

....

async myMethod () {
const request = new Request('post', 'localhost:3000/my_endpoint', { body: { name: 'Rails Fetch' }})
const request = new Request('post', 'localhost:3000/my_endpoint', { body: { name: 'Request.JS' }})
const response = await request.perform()
if (response.ok) {
const body = await response.text
Expand All @@ -35,10 +35,8 @@ async myMethod () {
}
```

# Credits

[Basecamp](https://github.com/basecamp), since this piece of code has been extracted from hey.com.

# License

Rails Fetch is released under the [MIT License](LICENSE).
Request.JS is released under the [MIT License](LICENSE).

© 2021 Basecamp, LLC.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "rails-fetch",
"name": "@rails/request.js",
"version": "0.0.2",
"description": "A tiny Fetch API wrapper that allows you to make http requests without need to handle to send the CSRF Token on every request",
"main": "./src/index.js",
"module": "./src/index.js",
"repository": "https://github.com/marcelolx/rails-fetch.git",
"repository": "https://github.com/rails/request.js",
"author": "Marcelo Lauxen <marcelolauxen16@gmail.com>",
"license": "MIT",
"private": false,
Expand All @@ -15,7 +15,7 @@
"fetch api"
],
"bugs": {
"url": "https://github.com/marcelolx/rails-fetch/issues"
"url": "https://github.com/rails/request.js"
},
"scripts": {
"lint": "standard src"
Expand Down