Skip to content

Commit

Permalink
fix: netlify.toml share 부분 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ej070961 committed Jan 25, 2024
1 parent 169c999 commit fb5bbc7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ to = "https://wiztrip.o-r.kr/:splat"
status = 200
force = true

[[redirects]]
from = "/share/proxy/*"
to = "https://wiztrip.o-r.kr/:splat"
status = 200
force = true




Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function App() {
<Route path="/login" element={<Login setIsLogin={setIsLogin} />} />
<Route path="/join" element={<Join />} />
</Route>
<Route path="/trips/share/:tripId" element={<Share />} />
<Route path="/share/:tripId" element={<Share />} />
<Route path="*" element={<NotFound />} />
</Routes>
</BrowserRouter>
Expand Down
1 change: 1 addition & 0 deletions src/apis/api/trip.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export async function createUrl(tripId) {
export async function getTripId(id) {
try {
const res = await axios.get(`${PROXY}/trips/share?url=${id}`);
console.log(res);
return res;
} catch (error) {
console.log('url 조회 Error', error);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Plan/Planheader.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Planheader({ userIdList }) {
const res = await createUrl(tripId);
if (res) {
// 클립보드에 URL 복사
await navigator.clipboard.writeText(`${domain}/trips/share/${res.url}`); // res.data.url은 API 응답에서 실제 URL을 가리킵니다.
await navigator.clipboard.writeText(`${domain}/share/${res.url}`); // res.data.url은 API 응답에서 실제 URL을 가리킵니다.
// 사용자에게 알림
alert('초대링크가 클립보드에 복사되었습니다.');
}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Share.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function Share() {
const res = await getTripId(id);
if (res) {
if (CheckLogin()) {
console.log('로그인 O');
const tripId = await GoToTrip(res.data.tripId, userId);
navigate(`/plan/${tripId}`);
} else {
Expand Down Expand Up @@ -46,6 +47,8 @@ export async function GoToTrip(tripId, userId){
// const navigate = useNavigate();
const tripData = await getTrip(tripId);

console.log(tripData);

//tripData 권한이 없는 유저라면
if(tripData===403){
//userId 추가 요청 코드
Expand Down

0 comments on commit fb5bbc7

Please sign in to comment.