Skip to content

Commit

Permalink
fix(develop): 공유 기능 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
taewan2002 committed Jan 4, 2024
1 parent 4a7d1b6 commit 966c0d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pages/diary/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -330,20 +330,22 @@ export default {
},
async shareURL() {
const { getShareMorningdiary, getShareNightdiary } = useDiaryService();
const base_url = window.location.origin;
const fullUrl = window.location.href;
const baseUrl = fullUrl.split("/").slice(0, 3).join("/");
// "https://docent.zip/share/${this.diary.id}?type=${this.type}"
let url = "";
if (this.type === "1") {
const res = await getShareMorningdiary(this.diary.id);
if (res.success) {
const id = res.data.id;
url = `${base_url}/share/${id}?type=1`; // 기본 URL과 결합
url = `${baseUrl}/share/${id}?type=1`; // 기본 URL과 결합
console.log(url)
}
} else if (this.type === "2") {
const res = await getShareNightdiary(this.diary.id);
if (res.success) {
const id = res.data.id;
url = `${base_url}/share/${id}?type=2`; // 기본 URL과 결합
url = `${baseUrl}/share/${id}?type=2`; // 기본 URL과 결합
}
}
try {
Expand Down

0 comments on commit 966c0d6

Please sign in to comment.