Skip to content

Commit

Permalink
feat : dummyAPI connect 성공!
Browse files Browse the repository at this point in the history
  • Loading branch information
moana16 committed May 17, 2023
1 parent 31d0ea4 commit bbe44e1
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 14 deletions.
186 changes: 183 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
},
"dependencies": {
"autoprefixer": "^10.4.14",
"axios": "^1.4.0",
"qs": "^6.11.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"recharts": "^2.5.0"
},
"devDependencies": {
"@crxjs/vite-plugin": "^1.0.12",
"@types/qs": "^6.9.7",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
"@vitejs/plugin-react": "^1.3.2",
Expand Down
30 changes: 30 additions & 0 deletions src/apis/service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import axios, { AxiosResponse } from 'axios';
import qs from 'qs';
import {parse, stringify} from 'qs'

export function getToken(): string | null {
if (typeof window !== "undefined") {
return localStorage.getItem("jwt");
}
return "";
}

export const popFilterAPI = axios.create({
baseURL: "https://www.popfilterbubble.site",
headers: {
accept: "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
"X-ACCESS-TOKEN": getToken(),
},

});

export async function getDummy(channelIdArr: string[]) {
const params = {
channelId : channelIdArr,
};
const queryString = qs.stringify(params,{arrayFormat : 'repeat'});
return await popFilterAPI.get(`/dummy/politics?${queryString}`);
}

Loading

0 comments on commit bbe44e1

Please sign in to comment.