Skip to content

Commit

Permalink
Merge pull request #9 from team-JMT/feature/group-list
Browse files Browse the repository at this point in the history
Feature/group list
  • Loading branch information
Parkjinhye authored Mar 12, 2024
2 parents 0a4df1f + 2e5b884 commit 11c635b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/apis/Instance.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import axios from 'axios';

import { nativeInfo } from '@utils/storage';

export const Instance = axios.create({
baseURL: 'https://api.jmt-matzip.dev',
headers: {
authorization: `Bearer eyJhbGciOiJIUzUxMiJ9.eyJhdXRoIjoiTUVNQkVSIiwiZW1haWwiOiJ0ZXN0QG5hdmVyLmNvbSIsImV4cCI6MTcwNzY0MjgzNH0.hQF0XNOcg6vYS-brtciaGd6eCbjJ1UmdN14sQbsqucJgDyslv4AeKLe0j71NH8aq0nVexBrhjm82rITFHPNTbA`,
authorization: `Bearer ${nativeInfo.getData().accessToken}`,
},
});
6 changes: 6 additions & 0 deletions src/utils/Bridge.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { nativeInfo } from './storage';
export type BridgeRequest<T> = {
name: string;
data?: T;
Expand All @@ -14,6 +15,11 @@ export const handleTestFail = () => {

export const handleConsoleValue = (value: string) => {
console.info('handleConsoleValue', value);
const prevState = nativeInfo.getData();
nativeInfo.setData({
...prevState,
accessToken: value,
});
};

if (window) {
Expand Down
34 changes: 34 additions & 0 deletions src/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function makeStorage<T extends Record<string, any>>(initialValue: T) {
let data = initialValue;

return {
setData: (nextData: T): void => {
data = nextData;
},
getData: (): T => data,
};
}

type LocationSearchData = {
placeName: string;
addressName: string;
roadAddressName: string;
x: string;
y: string;
};
type NativeInfo = {
accessToken: string;
userPosition: LocationSearchData;
};

export const nativeInfo = makeStorage<NativeInfo>({
accessToken:
'eyJhbGciOiJIUzUxMiJ9.eyJlbWFpbCI6InRlc3RAbmF2ZXIuY29tIiwiYXV0aCI6Ik1FTUJFUiIsImV4cCI6MTcxMDA4MjUxMX0.TChmWo1TeOtJZzeuHikhDJLdfKviTHkNVTFux5Up9_peKyFZKqIspuc3haVLhcSetOMdqIK3sCVi4iDyNFFu9Q',
userPosition: {
placeName: '',
addressName: '',
roadAddressName: '',
x: '127.0596',
y: '37.6633',
}, //x,y값은 임시입니당
});

0 comments on commit 11c635b

Please sign in to comment.