Skip to content

Commit

Permalink
feat(ErrorHandlingService): update links instead of base config to cl…
Browse files Browse the repository at this point in the history
…oud connection on token errors
  • Loading branch information
pkuehnel committed Jan 18, 2025
1 parent 2153530 commit 65be498
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion TeslaSolarCharger/Client/Dialogs/AddCarDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else if (_fleetApiTokenState != TokenState.UpToDate)
NoIcon="true"
ContentAlignment="HorizontalAlignment.Left">
<h4>Tesla Fleet API Token is not valid.</h4>
Go to <MudLink Href="/BaseConfiguration">Base Configuration</MudLink> and Generate a Tesla Fleet API Token.
Go to <MudLink Href="/cloudconnection">Cloud Connection</MudLink> and Generate a Tesla Fleet API Token.
</MudAlert>
}
else
Expand Down
2 changes: 1 addition & 1 deletion TeslaSolarCharger/Client/Pages/CarSettings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
NoIcon="true"
ContentAlignment="HorizontalAlignment.Left">
<h4>Create Token.</h4>
Go to <MudLink Href="/BaseConfiguration">Base Configuration</MudLink>, Generate a Tesla Fleet API Token and restart TSC to see cars here.
Go to <MudLink Href="/cloudconnection">Cloud Connection</MudLink>, Generate a Tesla Fleet API Token and restart TSC to see cars here.
</MudAlert>
}
@if (_fleetApiTokenState == TokenState.UpToDate)
Expand Down
12 changes: 6 additions & 6 deletions TeslaSolarCharger/Server/Services/ErrorHandlingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,22 +437,22 @@ private async Task DetectTokenStateIssues(List<LoggedError> activeErrors)
var backendTokenState = await tokenHelper.GetBackendTokenState(true);
var fleetApiTokenState = await tokenHelper.GetFleetApiTokenState(true);
await AddOrRemoveErrors(activeErrors, issueKeys.NoBackendApiToken, "No Backen API token",
"You are currently not connected to the backend. Open the <a href=\"/BaseConfiguration\">Base Configuration</a> and request a new token.",
"You are currently not connected to the backend. Open the <a href=\"/cloudconnection\">Cloud Connection</a> and request a new token.",
backendTokenState == TokenState.NotAvailable).ConfigureAwait(false);
await AddOrRemoveErrors(activeErrors, issueKeys.BackendTokenUnauthorized, "Backend Token Unauthorized",
"You recently changed your Solar4Car password or did not use TSC for at least 30 days. Open the <a href=\"/BaseConfiguration\">Base Configuration</a> and request a new token.",
"You recently changed your Solar4Car password or did not use TSC for at least 30 days. Open the <a href=\"/cloudconnection\">Cloud Connection</a> and request a new token.",
backendTokenState == TokenState.Unauthorized).ConfigureAwait(false);
await AddOrRemoveErrors(activeErrors, issueKeys.FleetApiTokenUnauthorized, "Fleet API token is unauthorized",
"You recently changed your Tesla password or did not enable mobile access in your car. Enable mobile access in your car and open the <a href=\"/BaseConfiguration\">Base Configuration</a> and request a new token. Important: You need to allow access to all selectable scopes.",
"You recently changed your Tesla password or did not enable mobile access in your car. Enable mobile access in your car and open the <a href=\"/cloudconnection\">Cloud Connection</a> and request a new token. Important: You need to allow access to all selectable scopes.",
fleetApiTokenState == TokenState.Unauthorized).ConfigureAwait(false);
await AddOrRemoveErrors(activeErrors, issueKeys.NoFleetApiToken, "No Fleet API Token available.",
"Open the <a href=\"/BaseConfiguration\">Base Configuration</a> and request a new token.",
"Open the <a href=\"/cloudconnection\">Cloud Connection</a> and request a new token.",
fleetApiTokenState == TokenState.NotAvailable).ConfigureAwait(false);
await AddOrRemoveErrors(activeErrors, issueKeys.FleetApiTokenExpired, "Fleet API token is expired",
"Either you recently changed your Tesla password or did not enable mobile access in your car. Enable mobile access in your car and open the <a href=\"/BaseConfiguration\">Base Configuration</a> and request a new token. Important: You need to allow access to all selectable scopes.",
"Either you recently changed your Tesla password or did not enable mobile access in your car. Enable mobile access in your car and open the <a href=\"/cloudconnection\">Cloud Connection</a> and request a new token. Important: You need to allow access to all selectable scopes.",
fleetApiTokenState == TokenState.Expired).ConfigureAwait(false);
await AddOrRemoveErrors(activeErrors, issueKeys.FleetApiTokenMissingScopes, "Your Tesla token has missing scopes.",
"Open the <a href=\"/BaseConfiguration\">Base Configuration</a> and request a new token. Note: You need to allow all selectable scopes as otherwise TSC won't work properly.",
"Open the <a href=\"/cloudconnection\">Cloud Connection</a> and request a new token. Note: You need to allow all selectable scopes as otherwise TSC won't work properly.",
fleetApiTokenState == TokenState.MissingScopes).ConfigureAwait(false);

//Remove all fleet api related issue keys on token error because very likely it is because of the underlaying token issue.
Expand Down

0 comments on commit 65be498

Please sign in to comment.