Client - reset user sport preferences - fix #123

This commit is contained in:
Sam 2021-12-19 12:23:40 +01:00
parent 91e7127a09
commit 781bf86634
14 changed files with 57 additions and 11 deletions

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.e77f8b26.css" rel="prefetch"><link href="/static/css/profile.8b668068.css" rel="prefetch"><link href="/static/css/reset.fc19709e.css" rel="prefetch"><link href="/static/css/statistics.2afdc8a9.css" rel="prefetch"><link href="/static/css/workouts.5ffd5cc1.css" rel="prefetch"><link href="/static/js/admin.5f46d0fe.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/profile.d25975e2.js" rel="prefetch"><link href="/static/js/reset.ca898ebe.js" rel="prefetch"><link href="/static/js/statistics.d03ca304.js" rel="prefetch"><link href="/static/js/workouts.e3d575e0.js" rel="prefetch"><link href="/static/css/app.c2c4db70.css" rel="preload" as="style"><link href="/static/js/app.b491eeb8.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.b68629ef.js" rel="preload" as="script"><link href="/static/css/app.c2c4db70.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.b68629ef.js"></script><script src="/static/js/app.b491eeb8.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.e77f8b26.css" rel="prefetch"><link href="/static/css/profile.8b668068.css" rel="prefetch"><link href="/static/css/reset.fc19709e.css" rel="prefetch"><link href="/static/css/statistics.2afdc8a9.css" rel="prefetch"><link href="/static/css/workouts.5ffd5cc1.css" rel="prefetch"><link href="/static/js/admin.5f46d0fe.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/profile.d25975e2.js" rel="prefetch"><link href="/static/js/reset.ca898ebe.js" rel="prefetch"><link href="/static/js/statistics.d03ca304.js" rel="prefetch"><link href="/static/js/workouts.e3d575e0.js" rel="prefetch"><link href="/static/css/app.18199525.css" rel="preload" as="style"><link href="/static/js/app.bc3e6d8e.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.b68629ef.js" rel="preload" as="script"><link href="/static/css/app.18199525.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.b68629ef.js"></script><script src="/static/js/app.bc3e6d8e.js"></script></body></html>

View File

@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/img/workouts/mountains.svg"
},
{
"revision": "b52103c76b5ae16c23a4fa6d38dd3236",
"revision": "68da405ddcdcb873267d9023ba64e3ea",
"url": "/index.html"
},
{
@ -80,8 +80,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/css/admin.e77f8b26.css"
},
{
"revision": "e68377b013509ba8b875",
"url": "/static/css/app.c2c4db70.css"
"revision": "aa7f9320c2fcbda8c105",
"url": "/static/css/app.18199525.css"
},
{
"revision": "82c1118c918377daaa71a320ab8eea42",
@ -192,8 +192,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/admin.5f46d0fe.js"
},
{
"revision": "e68377b013509ba8b875",
"url": "/static/js/app.b491eeb8.js"
"revision": "aa7f9320c2fcbda8c105",
"url": "/static/js/app.bc3e6d8e.js"
},
{
"revision": "bd7d183c9f68e5f4027d",

View File

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.77352451660657ca55df5d92cd08d84b.js"
"/precache-manifest.c377739f6f5fc95f644d2da41aa4727d.js"
);
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -138,6 +138,12 @@
<button :disabled="loading" @click="updateSportInEdition(null)">
{{ $t('buttons.CANCEL') }}
</button>
<button
:disabled="loading"
@click="(e) => resetSport(e, sport.id)"
>
{{ $t('buttons.RESET') }}
</button>
</div>
</td>
</tr>
@ -234,6 +240,13 @@
sportPayload
)
}
function resetSport(event: Event, sportId: number) {
event.preventDefault()
store.dispatch(
AUTH_USER_STORE.ACTIONS.RESET_USER_SPORT_PREFERENCES,
sportId
)
}
watch(
() => loading.value,
@ -287,6 +300,11 @@
min-width: 80px;
}
}
.sport-btn {
display: flex;
background: yellow;
gap: $default-padding;
}
.threshold-input {
padding: $default-padding * 0.5;
width: 50px;

View File

@ -10,6 +10,7 @@
"LOGIN": "Log in",
"NO": "No",
"REGISTER": "Register",
"RESET": "Reset",
"SUBMIT": "Submit",
"YES": "Yes"
}

View File

@ -10,6 +10,7 @@
"LOGIN": "Se connecter",
"NO": "Non",
"REGISTER": "S'inscrire",
"RESET": "Réinit.",
"SUBMIT": "Valider",
"YES": "Oui"
}

View File

@ -174,6 +174,26 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
)
},
[AUTH_USER_STORE.ACTIONS.RESET_USER_SPORT_PREFERENCES](
context: ActionContext<IAuthUserState, IRootState>,
sportId: number
): void {
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
authApi
.delete(`auth/profile/reset/sports/${sportId}`)
.then((res) => {
if (res.status === 204) {
context.dispatch(SPORTS_STORE.ACTIONS.GET_SPORTS)
} else {
handleError(context, null)
}
})
.catch((error) => {
handleError(context, error)
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
})
},
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_SPORT_PREFERENCES](
context: ActionContext<IAuthUserState, IRootState>,
payload: IUserSportPreferencesPayload

View File

@ -7,6 +7,7 @@ export enum AuthUserActions {
LOGOUT = 'LOGOUT',
SEND_PASSWORD_RESET_REQUEST = 'SEND_PASSWORD_RESET_REQUEST',
RESET_USER_PASSWORD = 'RESET_USER_PASSWORD',
RESET_USER_SPORT_PREFERENCES = 'RESET_USER_SPORT_PREFERENCES',
UPDATE_USER_PICTURE = 'UPDATE_USER_PICTURE',
UPDATE_USER_PROFILE = 'UPDATE_USER_PROFILE',
UPDATE_USER_PREFERENCES = 'UPDATE_USER_PREFERENCES',

View File

@ -73,6 +73,11 @@ export interface IAuthUserActions {
payload: IUserPasswordResetPayload
): void
[AUTH_USER_STORE.ACTIONS.RESET_USER_SPORT_PREFERENCES](
context: ActionContext<IAuthUserState, IRootState>,
sportId: number
): void
[AUTH_USER_STORE.ACTIONS.DELETE_ACCOUNT](
context: ActionContext<IAuthUserState, IRootState>,
payload: IUserDeletionPayload