Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Fix bug upload image from clipboard #44

Merged
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
5 changes: 3 additions & 2 deletions admin/src/components/editorjs/requiredTools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PluginId from '../../pluginId'
const axios = require('axios')
import { auth } from '@strapi/helper-plugin';

// Plugins for Editor.js
import Image from '@editorjs/image'
Expand All @@ -13,7 +14,7 @@ const requiredTools = {
data: JSON.stringify({})
},
additionalRequestHeaders: {
"Authorization": `Bearer ${JSON.parse(sessionStorage.getItem("jwtToken"))}`
"Authorization": `Bearer ${auth.getToken()}`
},
endpoints: {
byUrl: `/api/${PluginId}/image/byUrl`,
Expand All @@ -26,7 +27,7 @@ const requiredTools = {

const {data} = await axios.post(`/api/${PluginId}/image/byFile`, formData, {
headers: {
"Authorization": `Bearer ${JSON.parse(sessionStorage.getItem("jwtToken"))}`
"Authorization": `Bearer ${auth.getToken()}`
}
});

Expand Down
2 changes: 1 addition & 1 deletion admin/src/pluginId.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const pluginPkg = require('../../package.json');
const pluginId = pluginPkg.name.replace(
/^strapi-plugin-/i,
/^strapi-plugin-react-/i,
''
);

Expand Down