Skip to content

Commit

Permalink
address comments on package.json and urlExport.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
tatashidayat committed Jun 11, 2024
1 parent 903a962 commit b5b9aa2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "6.10.5",
"description": "Export design tokens from Figma",
"main": "plugin.js",
"engines": {
"node": "~18.20.3"
},
"repository": {
"type": "git",
"url": "https://github.com/lukasoppermann/design-tokens.git"
Expand Down Expand Up @@ -143,8 +146,5 @@
},
"dependencies": {
"react-dev-utils": "^12.0.1"
},
"volta": {
"node": "18.20.3"
}
}
24 changes: 10 additions & 14 deletions src/ui/modules/urlExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,16 @@ const addUrlExportRequestEvents = (request: XMLHttpRequest) => {

const generateUrlExportRequestBody = (exportSettings: urlExportSettings, requestBody: urlExportRequestBody) => {
let body
switch (exportSettings.authType) {
case config.key.authType.gitlabToken:
body = new FormData()
body.append('token', exportSettings.accessToken)
body.append('ref', exportSettings.reference)
body.append('variables[FIGMA_EVENT_TYPE]', requestBody.event_type)
body.append('variables[FIGMA_CLIENT_PAYLOAD_TOKENS]', requestBody.client_payload.tokens)
body.append('variables[FIGMA_CLIENT_PAYLOAD_FILENAME]', requestBody.client_payload.filename)
body.append('variables[FIGMA_CLIENT_PAYLOAD_COMMIT_MESSAGE]', requestBody.client_payload.commitMessage)
break;

default:
body = JSON.stringify(requestBody, null, 2)
break;
if (exportSettings.authType === config.key.authType.gitlabToken) {
body = new FormData()
body.append('token', exportSettings.accessToken)
body.append('ref', exportSettings.reference)
body.append('variables[FIGMA_EVENT_TYPE]', requestBody.event_type)
body.append('variables[FIGMA_CLIENT_PAYLOAD_TOKENS]', requestBody.client_payload.tokens)
body.append('variables[FIGMA_CLIENT_PAYLOAD_FILENAME]', requestBody.client_payload.filename)
body.append('variables[FIGMA_CLIENT_PAYLOAD_COMMIT_MESSAGE]', requestBody.client_payload.commitMessage)
} else {
body = JSON.stringify(requestBody, null, 2)
}
return body
}
Expand Down

0 comments on commit b5b9aa2

Please sign in to comment.