120
120
121
121
<script >
122
122
import { title , daysAgo } from ' ./filter' ;
123
- import { newHttpClient } from ' ./http' ;
123
+ import { rootUrl , newHttpClient } from ' ./http' ;
124
124
125
- const baseUrl = window .location .href .split (' /' ).slice (0 , 3 ).join (' /' );
126
125
const httpClient = newHttpClient ();
127
126
128
127
export default {
@@ -153,8 +152,8 @@ export default {
153
152
154
153
created () {
155
154
Promise .all ([
156
- httpClient .get (` ${ baseUrl } /v1/projects` ),
157
- httpClient .get (` ${ baseUrl } /v1/me` ),
155
+ httpClient .get (` ${ rootUrl } /v1/projects` ),
156
+ httpClient .get (` ${ rootUrl } /v1/me` ),
158
157
]).then (([projects , me ]) => {
159
158
this .items = projects .data ;
160
159
this .username = me .data .username ;
@@ -164,7 +163,7 @@ export default {
164
163
165
164
methods: {
166
165
deleteProject () {
167
- httpClient .delete (` ${ baseUrl } /v1/projects/${ this .project .id } ` ).then (() => {
166
+ httpClient .delete (` ${ rootUrl } /v1/projects/${ this .project .id } ` ).then (() => {
168
167
this .isDelete = false ;
169
168
const index = this .items .indexOf (this .project );
170
169
this .items .splice (index, 1 );
@@ -198,9 +197,9 @@ export default {
198
197
guideline: ' Please write annotation guideline.' ,
199
198
resourcetype: this .resourceType (),
200
199
};
201
- httpClient .post (` ${ baseUrl } /v1/projects` , payload)
200
+ httpClient .post (` ${ rootUrl } /v1/projects` , payload)
202
201
.then ((response ) => {
203
- window .location = ` ${ baseUrl } /projects/${ response .data .id } /docs/create` ;
202
+ window .location = ` ${ rootUrl } /projects/${ response .data .id } /docs/create` ;
204
203
})
205
204
.catch ((error ) => {
206
205
this .projectTypeError = ' ' ;
0 commit comments