mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-01-11 16:58:58 +01:00
Define accountCount internally instead of as a props
This commit is contained in:
parent
1864378c74
commit
b4ce39e9d5
@ -256,6 +256,18 @@ public function update(Request $request, $id)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A simple and light method to get the account count.
|
||||
*
|
||||
* @param \App\TwoFAccount $twofaccount
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function count(Request $request)
|
||||
{
|
||||
return response()->json([ 'count' => TwoFAccount::count() ], 200);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
|
@ -261,7 +261,7 @@
|
||||
this.$router.push({ name: 'createAccount' })
|
||||
}
|
||||
else {
|
||||
this.$router.push({ name: 'start', params: { accountCount: this.accounts.length } })
|
||||
this.$router.push({ name: 'start' })
|
||||
}
|
||||
},
|
||||
|
||||
@ -280,9 +280,9 @@
|
||||
})
|
||||
})
|
||||
|
||||
// No account yet, we push user to the start view
|
||||
// No account yet, we force user to land on the start view.
|
||||
if( this.accounts.length === 0 ) {
|
||||
this.$router.push({ name: 'start', params: { accountCount: 0 } });
|
||||
this.$router.push({ name: 'start' });
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer -->
|
||||
<vue-footer :showButtons="true">
|
||||
<vue-footer :showButtons="true" v-if="accountCount > 0">
|
||||
<!-- back button -->
|
||||
<p class="control">
|
||||
<router-link class="button is-dark is-rounded" :to="{ name: 'accounts' }" >
|
||||
@ -109,6 +109,7 @@
|
||||
|
||||
data(){
|
||||
return {
|
||||
accountCount: null,
|
||||
form: new Form({
|
||||
qrcode: null,
|
||||
uri: '',
|
||||
@ -121,7 +122,14 @@
|
||||
}
|
||||
},
|
||||
|
||||
props: ['accountCount'],
|
||||
// props: ['accountCount'],
|
||||
|
||||
mounted() {
|
||||
|
||||
this.axios.get('api/twofaccounts/count').then(response => {
|
||||
this.accountCount = response.data.count
|
||||
})
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
Route::patch('twofaccounts/reorder', 'TwoFAccountController@reorder');
|
||||
Route::post('twofaccounts/preview', 'TwoFAccountController@preview');
|
||||
Route::get('twofaccounts/{twofaccount}/withSensitive', 'TwoFAccountController@showWithSensitive');
|
||||
Route::get('twofaccounts/count', 'TwoFAccountController@count');
|
||||
Route::apiResource('twofaccounts', 'TwoFAccountController');
|
||||
Route::patch('group/accounts', 'GroupController@associateAccounts');
|
||||
Route::apiResource('groups', 'GroupController');
|
||||
|
Loading…
Reference in New Issue
Block a user