File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 79
79
</button >
80
80
</div >
81
81
<p v-else class =" mt-2 text-amber-600" >
82
- 已由 {{ application. commitBy }} 於 {{ dateParsedApprovalAt }} 簽署 {{ application.commitState ? '許可' : '否決' }}
82
+ 已由 {{ commitBy }} 於 {{ dateParsedCommitAt }} 簽署 {{ application.commitState ? '許可' : '否決' }}
83
83
</p >
84
84
</div >
85
85
</div >
@@ -105,13 +105,21 @@ export default {
105
105
ready: false ,
106
106
query: null ,
107
107
status: null ,
108
+ commitBy: null ,
108
109
application: {}
109
110
}),
110
111
methods: {
111
112
dateToHuman (timestamp ) {
112
113
const userTimezone = dayjs .tz .guess ();
113
114
return dayjs .tz (timestamp, userTimezone).format (" llll" );
114
115
},
116
+ async getUserNickname (commitBy ) {
117
+ const xhr = await this .$axios .get (` https://web-tech.tw/recv/sara/users/${ commitBy} ` );
118
+ if (xhr .status !== 200 ) {
119
+ return commitBy;
120
+ }
121
+ return xhr? .data ? .profile ? .nickname || commitBy;
122
+ },
115
123
async submit () {
116
124
this .status = ' ' ;
117
125
if (! this .query ) {
@@ -122,6 +130,11 @@ export default {
122
130
try {
123
131
const xhr = await this .$axios .get (" applications" , options);
124
132
this .application = xhr .data ;
133
+ const {commitBy } = this .application ;
134
+ if (commitBy) {
135
+ this .commitBy = await this .getUserNickname (commitBy);
136
+ return ;
137
+ }
125
138
this .status = " " ;
126
139
} catch (e) {
127
140
this .application = {};
@@ -172,7 +185,7 @@ export default {
172
185
createdAt,
173
186
);
174
187
},
175
- dateParsedApprovalAt () {
188
+ dateParsedCommitAt () {
176
189
const {
177
190
commitAt ,
178
191
} = this .application ;
You can’t perform that action at this time.
0 commit comments