Skip to content

Commit 0d3205a

Browse files
committed
refactor: update for new api routes
1 parent e7993ea commit 0d3205a

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

src/views/AdminJoinView.vue

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
<li>申請時間:{{ dateParsedCreatedAt }}</li>
3434
</ul>
3535
<ul class="mb-3">
36-
<li>IP 位址:{{ application.ip_address }}</li>
36+
<li>IP 位址:{{ application.ipAddress }}</li>
3737
<li>IP 地理資訊:
3838
<ul class="pl-3">
39-
<li>國家:{{ application.ip_geolocation.country }}</li>
40-
<li>城市:{{ application.ip_geolocation.city }}</li>
41-
<li>時區:{{ application.ip_geolocation.timezone }}</li>
39+
<li>國家:{{ application.ipGeolocation.country }}</li>
40+
<li>城市:{{ application.ipGeolocation.city }}</li>
41+
<li>時區:{{ application.ipGeolocation.timezone }}</li>
4242
</ul>
4343
</li>
4444
</ul>
@@ -66,7 +66,7 @@
6666
</li>
6767
</ul>
6868
</p>
69-
<div v-if="!application.approval_by" class="flex justify-end mt-4">
69+
<div v-if="!application.commitBy" class="flex justify-end mt-4">
7070
<button
7171
class="flex items-center justify-center bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 mx-1 rounded-full"
7272
@click="approval">
@@ -79,7 +79,7 @@
7979
</button>
8080
</div>
8181
<p v-else class="mt-2 text-amber-600">
82-
已由 {{ application.approval_by }} 於 {{ dateParsedApprovalAt }} 許可
82+
已由 {{ application.commitBy }} 於 {{ dateParsedApprovalAt }} 簽署 {{ application.commitState ? '許可' : '否決' }}
8383
</p>
8484
</div>
8585
</div>
@@ -133,18 +133,24 @@ export default {
133133
}
134134
},
135135
async approval() {
136-
const options = {params: {code: this.query}};
136+
const options = {params: {
137+
code: this.query,
138+
state: "true",
139+
}};
137140
try {
138-
await this.$axios.patch("application", null, options)
141+
await this.$axios.patch("applications", null, options)
139142
await this.submit()
140143
} catch (e) {
141144
console.error(e)
142145
}
143146
},
144147
async reject() {
145-
const options = {params: {code: this.query}};
148+
const options = {params: {
149+
code: this.query,
150+
state: "false",
151+
}};
146152
try {
147-
await this.$axios.delete("application", options)
153+
await this.$axios.patch("applications", null, options)
148154
this.application = {}
149155
} catch (e) {
150156
console.error(e)
@@ -154,24 +160,24 @@ export default {
154160
computed: {
155161
uaParsed() {
156162
const {
157-
user_agent: uaString,
163+
userAgent: uaString,
158164
} = this.application;
159165
return uaParser(uaString);
160166
},
161167
dateParsedCreatedAt() {
162168
const {
163-
created_at: createdAt,
169+
createdAt,
164170
} = this.application;
165171
return this.dateToHuman(
166-
createdAt * 1000,
172+
createdAt,
167173
);
168174
},
169175
dateParsedApprovalAt() {
170176
const {
171-
approval_at: approvalAt,
177+
commitAt,
172178
} = this.application;
173179
return this.dateToHuman(
174-
approvalAt * 1000,
180+
commitAt,
175181
);
176182
},
177183
},

src/views/AdminRoomView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default {
8080
return;
8181
}
8282
try {
83-
const xhr = await this.$axios.get('/admin-room');
83+
const xhr = await this.$axios.get('/admin-rooms');
8484
this.url = xhr.data.url;
8585
this.password = xhr.data.password;
8686
} catch (error) {

src/views/JoinChatView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export default {
127127
form.set('slug', this.code);
128128
form.set('captcha', this.captcha);
129129
try {
130-
const xhr = await this.$axios.post('application', form)
130+
const xhr = await this.$axios.post("applications", form)
131131
this.ready = true;
132132
this.secret = xhr.data.code;
133133
} catch (e) {

0 commit comments

Comments
 (0)