Skip to content

Commit

Permalink
TNO-2293 Fix first time login issue (#1506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fosol authored Feb 7, 2024
1 parent fe4aa27 commit 572ae71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion app/subscriber/src/store/hooks/app/useApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const useApp = (): [IAppState, IAppController] => {
() => ({
getUserInfo: async (refresh: boolean = false) => {
if (userInfo.id !== 0 && !refresh) return userInfo;
var location: IUserLocationModel;
var location: IUserLocationModel | undefined;
try {
// Generate a unique key for this user and store in local storage.
var key = localStorage.getItem('device-key');
Expand All @@ -99,6 +99,7 @@ export const useApp = (): [IAppState, IAppController] => {
() => axios.get('https://geolocation-db.com/json/'),
'location',
true,
true,
);
location = { ...locationResponse.data, key };
} catch {
Expand Down
17 changes: 10 additions & 7 deletions app/subscriber/src/store/hooks/useAjaxWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const useAjaxWrapper = () => {
request: () => Promise<AxiosResponse<T>>,
group: string | string[] | undefined = undefined,
isSilent: boolean = false,
onlyThrowError: boolean = false,
): Promise<AxiosResponse<T>> => {
try {
app.addRequest(name, group, isSilent);
Expand Down Expand Up @@ -52,13 +53,15 @@ export const useAjaxWrapper = () => {
.map((p) => p.toString())
.toString();
}
app.addError({
status: ae.response?.status,
statusText: ae.response?.statusText,
data: ae.response?.data,
message: message,
detail,
});
if (!onlyThrowError) {
app.addError({
status: ae.response?.status,
statusText: ae.response?.statusText,
data: ae.response?.data,
message: message,
detail,
});
}

throw error;
} finally {
Expand Down

0 comments on commit 572ae71

Please sign in to comment.