-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { default: axios } = require('axios'); | ||
|
||
// axios.defaults.baseURL = "https://api.gosrock.band"; | ||
const { default: InstanceSetting } = require('../common/instance.api'); | ||
|
||
class TicketsApi extends InstanceSetting { | ||
constructor() { | ||
super('https://api.gosrock.band/v1/tickets'); | ||
} | ||
|
||
// 예시임다 | ||
getTickets = async ({ phoneNumber, slackEmail }) => { | ||
await this.axiosInstance.post('/slack/send', { | ||
phoneNumber, | ||
slackEmail | ||
}); | ||
}; | ||
} | ||
export default new TicketsApi(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { LOGOUT_USER } from "../action-types/logout"; | ||
import axios from "axios"; | ||
import history from "../../history"; | ||
import ticketsApi from "../../apis/tickets/tickets.api"; | ||
import { LOGOUT_USER } from '../action-types/logout'; | ||
import axios from 'axios'; | ||
import history from '../../history'; | ||
import TicketsApi from '../../apis/tickets/TicketsApi'; | ||
|
||
export const logout = (callback) => async (dispatch) => { | ||
export const logout = callback => async dispatch => { | ||
dispatch({ type: LOGOUT_USER }); | ||
|
||
localStorage.setItem("accessToken", null); | ||
localStorage.setItem('accessToken', null); | ||
axios.defaults.headers.common.Authorization = null; | ||
|
||
// 자동으로 피쳐로 넘어가게끔 | ||
history.push("/auth/login"); | ||
ticketsApi.expireAccessTokne(); | ||
console.log(ticketsApi.axiosInstance.defaults.headers); | ||
history.push('/auth/login'); | ||
TicketsApi.expireAccessTokne(); | ||
console.log(TicketsApi.axiosInstance.defaults.headers); | ||
|
||
callback(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import axios from "axios"; | ||
import authApi from "../../apis/auth/auth.api"; | ||
import ErrorResponse from "../../apis/common/ErrorResponse"; | ||
import axios from 'axios'; | ||
import AuthApi from '../../apis/auth/AuthApi'; | ||
|
||
import ErrorResponse from '../../apis/common/ErrorResponse'; | ||
|
||
import { | ||
SLACK_MESSAGE_PENDING, | ||
SLACK_MESSAGE_SUCCESS, | ||
SLACK_MESSAGE_FAIL, | ||
} from "../action-types"; | ||
SLACK_MESSAGE_FAIL | ||
} from '../action-types'; | ||
|
||
export const slackMessage = | ||
({ phoneNumber, slackEmail }, callback) => | ||
async (dispatch) => { | ||
async dispatch => { | ||
try { | ||
dispatch({ type: SLACK_MESSAGE_PENDING }); | ||
|
||
|
@@ -19,9 +20,9 @@ export const slackMessage = | |
// "slackEmail": "[email protected]" | ||
// } | ||
|
||
const response = await authApi.requestSlackValidationNumber({ | ||
const response = await AuthApi.requestSlackValidationNumber({ | ||
phoneNumber, | ||
slackEmail, | ||
slackEmail | ||
}); | ||
// const response = await axios.post( | ||
// "https://api.gosrock.band/v1/auth/slack/send", | ||
|
@@ -30,19 +31,18 @@ export const slackMessage = | |
// slackEmail, | ||
// } | ||
// ); | ||
|
||
console.log(response); | ||
// console.log(response); | ||
|
||
dispatch({ | ||
type: SLACK_MESSAGE_SUCCESS, | ||
payload: response.data.data.validationNumber, | ||
payload: response.data.data.validationNumber | ||
}); | ||
|
||
callback(); | ||
} catch (e) { | ||
dispatch({ | ||
type: SLACK_MESSAGE_FAIL, | ||
payload: new ErrorResponse(e.response.data.error), | ||
payload: new ErrorResponse(e.response.data.error) | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters