Skip to content
Snippets Groups Projects
Commit 54e782ed authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Merge branch 'feat--Handle-403-errors-from-server' into 'dev'

feat: Handle 403 errors from server

See merge request web-et-numerique/llle_project/backoffice-client!16
parents baa35cf4 5df2fbd4
No related branches found
No related tags found
3 merge requests!24fix(typo): écogestes + optionnel poll,!22feat: Add partners issue info,!16feat: Handle 403 errors from server
Pipeline #18086 passed
...@@ -31,8 +31,14 @@ export class NewsletterService { ...@@ -31,8 +31,14 @@ export class NewsletterService {
} }
) )
toast.success('Monthly info succesfully saved !') toast.success('Monthly info succesfully saved !')
} catch (e) { } catch (e: any) {
toast.error('Failed to create monthly info') if (e.response.status === 403) {
toast.error(
"Unauthorized : You don't have the rights to do this operation"
)
} else {
toast.error('Failed to create monthly info')
}
console.error(e) console.error(e)
} }
} }
...@@ -56,7 +62,7 @@ export class NewsletterService { ...@@ -56,7 +62,7 @@ export class NewsletterService {
} }
) )
return data as IMonthlyInfo return data as IMonthlyInfo
} catch (e) { } catch (e: any) {
console.error('error', e) console.error('error', e)
return null return null
} }
...@@ -81,8 +87,14 @@ export class NewsletterService { ...@@ -81,8 +87,14 @@ export class NewsletterService {
} }
) )
toast.success('Monthly info succesfully deleted !') toast.success('Monthly info succesfully deleted !')
} catch (e) { } catch (e: any) {
toast.error('Failed to delete monthly info') if (e.response.status === 403) {
toast.error(
"Unauthorized : You don't have the rights to do this operation"
)
} else {
toast.error('Failed to delete monthly info')
}
console.error(e) console.error(e)
} }
} }
...@@ -115,8 +127,14 @@ export class NewsletterService { ...@@ -115,8 +127,14 @@ export class NewsletterService {
} }
) )
toast.success('Monthly news succesfully saved !') toast.success('Monthly news succesfully saved !')
} catch (e) { } catch (e: any) {
toast.error('Failed to create monthly news') if (e.response.status === 403) {
toast.error(
"Unauthorized : You don't have the rights to do this operation"
)
} else {
toast.error('Failed to save monthly news')
}
console.error(e) console.error(e)
} }
} }
...@@ -165,8 +183,14 @@ export class NewsletterService { ...@@ -165,8 +183,14 @@ export class NewsletterService {
} }
) )
toast.success('Monthly news succesfully deleted !') toast.success('Monthly news succesfully deleted !')
} catch (e) { } catch (e: any) {
toast.error('Failed to delete monthly news') if (e.response.status === 403) {
toast.error(
"Unauthorized : You don't have the rights to do this operation"
)
} else {
toast.error('Failed to delete monthly news')
}
console.error(e) console.error(e)
} }
} }
...@@ -199,8 +223,14 @@ export class NewsletterService { ...@@ -199,8 +223,14 @@ export class NewsletterService {
} }
) )
toast.success('Poll successfully saved !') toast.success('Poll successfully saved !')
} catch (e) { } catch (e: any) {
toast.error('Failed to create poll') if (e.response.status === 403) {
toast.error(
"Unauthorized : You don't have the rights to do this operation"
)
} else {
toast.error('Failed to create poll')
}
console.error(e) console.error(e)
} }
} }
...@@ -246,8 +276,14 @@ export class NewsletterService { ...@@ -246,8 +276,14 @@ export class NewsletterService {
} }
) )
toast.success('Poll succesfully deleted !') toast.success('Poll succesfully deleted !')
} catch (e) { } catch (e: any) {
toast.error('Failed to delete poll') if (e.response.status === 403) {
toast.error(
"Unauthorized : You don't have the rights to do this operation"
)
} else {
toast.error('Failed to delete poll')
}
console.error(e) console.error(e)
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment