Skip to content

Commit a36ea39

Browse files
committed
fixed 401 and logout after password update
1 parent 63acd89 commit a36ea39

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

resources/js/layouts/App.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ export default {
1313
...mapActions(useAuthStore, ['logout']),
1414
},
1515
mounted() {
16-
axios.interceptors.response.use(function (response) {
16+
axios.interceptors.response.use((response) => {
1717
return response;
18-
}, function (error) {
18+
}, (error) => {
19+
console.error(error)
1920
if (error.response.status === 401 || error.response.status === 419) {
2021
if (error.response.data.message === 'CSRF token mismatch.') return
2122
this.logout()
23+
.catch((error) => { console.error(error) })
2224
router.replace({ name: 'Login' })
2325
} else if (error.response.status === 403) {
2426
router.push({ name: 'VerifyEmail' })

resources/js/pages/auth/Login.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
</label>
1111
<input v-model="data.email"
1212
class="p-2 rounded-md shadow-sm bg-white border border-gray-300 text-gray-400 block mt-1 w-full" id="email"
13-
type="email" name="email" required="required" autofocus="autofocus" value="[email protected]">
13+
type="email" name="email" required="required" autofocus="autofocus">
1414
</div>
1515
<div class="mt-4">
1616
<label class="block font-medium text-sm text-gray-500" for="password">
1717
Password
1818
</label>
1919
<input v-model="data.password"
2020
class="p-2 rounded-md shadow-sm bg-white border border-gray-300 text-gray-400 focus:border-green-500 focus:ring focus:ring-green-500 focus:ring-opacity-50 block mt-1 w-full"
21-
id="password" type="password" name="password" required="required" autocomplete="current-password"
22-
value="password">
21+
id="password" type="password" name="password" required="required" autocomplete="current-password">
2322
</div>
2423
<div v-if="errors" class="text-red-500 py-2 font-semibold">
2524
<span>{{ errors.message }}</span>

0 commit comments

Comments
 (0)