mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-15 22:48:00 +02:00
fix(admin): bind token form to dotted scope to escape ng-if child scope
The Generate button silently no-op'd because ng-model="newTokenName" inside
an ng-if block wrote to a child scope, leaving $scope.newTokenName empty.
Use $scope.tokenForm.{name,plaintext} so prototypal lookup resolves to the
controller scope.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -199,8 +199,7 @@ angular
|
||||
getUserRepositories($routeParams.username);
|
||||
|
||||
$scope.tokens = [];
|
||||
$scope.newTokenName = "";
|
||||
$scope.newTokenPlaintext = null;
|
||||
$scope.tokenForm = { name: "", plaintext: null };
|
||||
|
||||
function loadTokens() {
|
||||
$http.get("/api/admin/tokens").then(
|
||||
@@ -215,13 +214,13 @@ angular
|
||||
loadTokens();
|
||||
|
||||
$scope.createToken = () => {
|
||||
if (!$scope.newTokenName) return;
|
||||
if (!$scope.tokenForm.name) return;
|
||||
$http
|
||||
.post("/api/admin/tokens", { name: $scope.newTokenName })
|
||||
.post("/api/admin/tokens", { name: $scope.tokenForm.name })
|
||||
.then(
|
||||
(res) => {
|
||||
$scope.newTokenPlaintext = res.data.token;
|
||||
$scope.newTokenName = "";
|
||||
$scope.tokenForm.plaintext = res.data.token;
|
||||
$scope.tokenForm.name = "";
|
||||
loadTokens();
|
||||
},
|
||||
(err) => console.error(err)
|
||||
|
||||
Vendored
+2
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user