File tree 3 files changed +13
-15
lines changed
3 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 1
1
MIT License
2
2
3
- Copyright (c) 2021 Marcelo Lauxen
3
+ Copyright (c) 2021 Basecamp
4
4
5
5
Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change 1
- # Rails Fetch
1
+ # Request.JS
2
2
3
- Rails Fetch encapsulates the logic to send by default some headers that are required by rails applications like the ` X-CSRF-Token ` .
3
+ Request.JS encapsulates the logic to send by default some headers that are required by rails applications like the ` X-CSRF-Token ` .
4
4
5
5
# Install
6
6
7
7
### npm
8
8
```
9
- npm i rails-fetch
9
+ npm i @ rails/request.js
10
10
```
11
11
### yarn
12
12
``` shell
13
- yarn add rails-fetch
13
+ yarn add @ rails/request.js
14
14
```
15
15
16
16
# How to use
@@ -20,12 +20,12 @@ Just import the `Request` class from the package and instantiate it passing the
20
20
Example:
21
21
22
22
``` js
23
- import { Request } from ' rails-fetch '
23
+ import { Request } from ' @ rails/request.js '
24
24
25
25
... .
26
26
27
27
async myMethod () {
28
- const request = new Request (' post' , ' localhost:3000/my_endpoint' , { body: { name: ' Rails Fetch ' }})
28
+ const request = new Request (' post' , ' localhost:3000/my_endpoint' , { body: { name: ' Request.JS ' }})
29
29
const response = await request .perform ()
30
30
if (response .ok ) {
31
31
const body = await response .text
@@ -35,10 +35,8 @@ async myMethod () {
35
35
}
36
36
```
37
37
38
- # Credits
39
-
40
- [ Basecamp] ( https://github.com/basecamp ) , since this piece of code has been extracted from hey.com.
41
-
42
38
# License
43
39
44
- Rails Fetch is released under the [ MIT License] ( LICENSE ) .
40
+ Request.JS is released under the [ MIT License] ( LICENSE ) .
41
+
42
+ © 2021 Basecamp, LLC.
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " rails-fetch " ,
2
+ "name" : " @ rails/request.js " ,
3
3
"version" : " 0.0.2" ,
4
4
"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" ,
5
5
"main" : " ./src/index.js" ,
6
6
"module" : " ./src/index.js" ,
7
- "repository" : " https://github.com/marcelolx/ rails-fetch.git " ,
7
+ "repository" : " https://github.com/rails/request.js " ,
8
8
"author" : " Marcelo Lauxen <marcelolauxen16@gmail.com>" ,
9
9
"license" : " MIT" ,
10
10
"private" : false ,
15
15
" fetch api"
16
16
],
17
17
"bugs" : {
18
- "url" : " https://github.com/marcelolx/ rails-fetch/issues "
18
+ "url" : " https://github.com/rails/request.js "
19
19
},
20
20
"scripts" : {
21
21
"lint" : " standard src"
You can’t perform that action at this time.
0 commit comments