Skip to content

Commit 4d4bfe3

Browse files
committed
chore: 검증 요청 개선
1 parent 0086627 commit 4d4bfe3

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

a.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(async () => {
2+
const file = await fetch('credentials.json');
3+
console.log(file);
4+
})()

src/background.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
console.log('Bootstrapping.');
2-
import * as fs from 'fs';
32

43
interface Music {
54
name: string;
@@ -53,10 +52,12 @@ const specify = () => {
5352
});
5453
}
5554

56-
const credentials = JSON.parse(fs.readFileSync('credentials.json', 'utf8'));
57-
const updateProfile = (music: Music) => {
58-
const id = credentials.id;
59-
const oauth = credentials.oauth;
55+
const updateProfile = async (music: Music) => {
56+
const credentials = await (await fetch('credentials.json')).json();
57+
console.log(credentials);
58+
59+
const id = credentials['id'];
60+
const oauth = credentials['key'];
6061
const message = `now i'my playing ${music.name}`;
6162
const auth = `token ${oauth}`;
6263

webpack.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const path = require('path');
33
const { join } = require('path');
44

55
module.exports = {
6-
target: "node",
76
entry: {
87
background: join(__dirname, 'src/background.ts'),
98
},

0 commit comments

Comments
 (0)