Skip to content
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
6 changes: 4 additions & 2 deletions js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export async function get(
//
export async function post(
action: string,
params: Object
params: Object,
headers?: Record<string, string>
): Promise<Object> {
// Rails generates meta tags with anti-CSRF information.
const csrfParamMeta = document.getElementsByName('csrf-param')[0];
Expand All @@ -140,7 +141,8 @@ export async function post(
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json'
Accept: 'application/json',
...headers
},
body: JSON.stringify(params)
});
Expand Down
48 changes: 24 additions & 24 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "rails-pages",
"version": "0.2.0",
"description": "The JS half of the rails_pages ruby gem",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"build": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/degica/rails_pages.git"
},
"author": "Nigel Baillie <nigelbaillie@hey.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/degica/rails_pages/issues"
},
"homepage": "https://github.com/degica/rails_pages#readme",
"devDependencies": {
"typescript": "^5.7.3"
},
"dependencies": {
"vue": "^3.1.0"
}
"name": "rails-pages",
"version": "0.3.0",
"description": "The JS half of the rails_pages ruby gem",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"build": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/degica/rails_pages.git"
},
"author": "Nigel Baillie <nigelbaillie@hey.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/degica/rails_pages/issues"
},
"homepage": "https://github.com/degica/rails_pages#readme",
"devDependencies": {
"typescript": "^5.7.3"
},
"dependencies": {
"vue": "^3.1.0"
}
}
Loading