Skip to content

Commit

Permalink
🚑 Fixed proxy server link
Browse files Browse the repository at this point in the history
  • Loading branch information
LaptevPavel committed Feb 7, 2021
1 parent b26df59 commit c0a5307
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "JSON to Figma 3.2",
"name": "JSON to Figma",
"id": "789839703871161985",
"api": "1.0.0",
"main": "dist/code.js",
Expand Down
1 change: 0 additions & 1 deletion src/app/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const App = ({}) => {
// Add Msg Listener
const MsgListener = e => {
if (e.data.pluginMessage.type === 'image-url') {
console.log('sd');
const imgURL = e.data.pluginMessage.url;
fetchImagefromURL(imgURL, e.data.pluginMessage.targetID);
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/utils/fetchImagefromURL.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {proxyServer} from './proxyServer';

export default async function fetchImagefromURL(url, targetID) {
const proxyServer = 'https://cors-anywhere.herokuapp.com';
await fetch(`${proxyServer}/${url}`)
.then(r => {
try {
Expand Down
3 changes: 2 additions & 1 deletion src/app/utils/fetchJSONfromURL.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {isLocalhost} from './';
import {proxyServer} from './proxyServer';

export default async function fetchJSONfromURL(
url,
Expand All @@ -7,7 +8,7 @@ export default async function fetchJSONfromURL(
console.error(error);
}
) {
const fetchURL = isLocalhost(url) ? url : `https://cors-anywhere.herokuapp.com/${url}`;
const fetchURL = isLocalhost(url) ? url : `${proxyServer}/${url}`;
return await fetch(fetchURL)
.then(response => response.json())
.then(responseJson => {
Expand Down
1 change: 1 addition & 0 deletions src/app/utils/proxyServer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const proxyServer = 'https://secure-thicket-88117.herokuapp.com';

0 comments on commit c0a5307

Please sign in to comment.